
Security News
Open Source Maintainers Demand Ability to Block Copilot-Generated Issues and PRs
Open source maintainers are urging GitHub to let them block Copilot from submitting AI-generated issues and pull requests to their repositories.
@angular/platform-server
Advanced tools
@angular/platform-server is an Angular package that enables server-side rendering (SSR) for Angular applications. It allows you to render Angular applications on the server, which can improve performance, SEO, and user experience by delivering fully rendered pages to the client.
Server-Side Rendering (SSR)
This feature allows you to render an Angular application on the server. The `renderModule` function takes an Angular module and renders it to a string, which can then be sent to the client.
const { renderModule } = require('@angular/platform-server');
const { AppServerModule } = require('./src/main.server');
renderModule(AppServerModule, {
document: '<app-root></app-root>',
url: '/'
}).then(html => {
console.log(html);
});
Preboot
Preboot is a library that works with Angular Universal to record and playback user events while the client-side app is loading. This code sample demonstrates how to set up a global window and document object using the 'domino' library to enable Preboot.
const { renderModule } = require('@angular/platform-server');
const { AppServerModule } = require('./src/main.server');
const { createWindow } = require('domino');
const win = createWindow('<html><head></head><body><app-root></app-root></body></html>');
global['window'] = win;
global['document'] = win.document;
global['navigator'] = win.navigator;
renderModule(AppServerModule, {
document: win.document,
url: '/'
}).then(html => {
console.log(html);
});
Transfer State
Transfer State allows you to transfer state from the server to the client, reducing the need for duplicate HTTP requests. This code sample shows how to import and use the ServerTransferStateModule in your server-side module.
import { NgModule } from '@angular/core';
import { ServerModule, ServerTransferStateModule } from '@angular/platform-server';
import { AppComponent } from './app.component';
import { AppModule } from './app.module';
@NgModule({
imports: [
AppModule,
ServerModule,
ServerTransferStateModule
],
bootstrap: [AppComponent],
})
export class AppServerModule {}
Next.js is a React framework that enables server-side rendering and static site generation. It provides a similar SSR functionality to @angular/platform-server but is designed for React applications. It also includes features like API routes, automatic code splitting, and more.
Nuxt.js is a framework for Vue.js that enables server-side rendering and static site generation. It offers similar SSR capabilities to @angular/platform-server but is tailored for Vue.js applications. Nuxt.js also provides features like automatic routing, Vuex store integration, and more.
Sapper is a framework for Svelte that provides server-side rendering and other advanced features. It offers similar SSR functionality to @angular/platform-server but is designed for Svelte applications. Sapper also includes features like file-based routing and prefetching.
The sources for this package are in the main Angular repo. Please file issues and pull requests against that repo.
Usage information and reference details can be found in Angular documentation.
License: MIT
20.0.0-next.2 (2025-03-12)
InjectFlags
has been removed.inject
no longer accepts InjectFlags
.Injector.get
no longer accepts InjectFlags
.EnvironmentInjector.get
no longer accepts InjectFlags
.TestBed.get
no longer accepts InjectFlags
.TestBed.inject
no longer accepts InjectFlags
.any
overload has been removed from
injector.get
. It now only supports ProviderToken<T>
and (deprecated
since v4) string
.ApplicationRef.tick
will no longer catch and report
errors to the appplication ErrorHandler
. Errors will instead be thrown out of
the method and will allow callers to determine how to handle these
errors, such as aborting follow-up work or reporting the error and
continuing.| Commit | Type | Description | | -- | -- | -- | | 92250493ff | fix | support equality function in httpResource (#60026) |
| Commit | Type | Description | | -- | -- | -- | | ef1fd137a9 | fix | incorrect spans for template literals (#60323) |
| Commit | Type | Description | | -- | -- | -- | | a1cacc5b17 | fix | avoid fatal diagnostics for missing template files (#58673) | | 9be2b334ed | fix | handle transformed classes when generating HMR code (#60298) |
| Commit | Type | Description |
| -- | -- | -- |
| 611baaf069 | feat | remove InjectFlags from public API (#60318) |
| e170d24240 | fix | add migration away from InjectFlags (#60318) |
| 79ae35577e | fix | check whether application is destroyed before initializing event replay (#59789) |
| c82384104f | fix | ensures immediate trigger fires properly with lazy loaded routes (#60203) |
| de2bfc0913 | fix | fix removal of a container reference used in the component file (#60210) |
| ff772d7800 | fix | fix typing on injector.get to omit 'any' (#60202) |
| 338818ce89 | fix | Surface errors from ApplicationRef.tick
to callsite (#60102) |
| Commit | Type | Description | | -- | -- | -- | | 81fe0536fd | fix | Make sure statusChanges is emitted (#57098) |
| Commit | Type | Description | | -- | -- | -- | | a980ac9a6a | refactor | Deprecate the HammerJS integration (#60257) |
| Commit | Type | Description |
| -- | -- | -- |
| 0cff9a12d3 | fix | add missing peer dependency for rxjs
(#60308) |
| Commit | Type | Description | | -- | -- | -- | | 219f41d049 | fix | Prevent dangling promise rejections from internal navigations (#60162) | | cae1fe519b | fix | update symbols (#60233) |
<!-- CHANGELOG SPLIT MARKER --><a name="19.2.2"></a>
FAQs
Angular - library for using Angular in Node.js
The npm package @angular/platform-server receives a total of 380,329 weekly downloads. As such, @angular/platform-server popularity was classified as popular.
We found that @angular/platform-server demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Open source maintainers are urging GitHub to let them block Copilot from submitting AI-generated issues and pull requests to their repositories.
Research
Security News
Malicious Koishi plugin silently exfiltrates messages with hex strings to a hardcoded QQ account, exposing secrets in chatbots across platforms.
Research
Security News
Malicious PyPI checkers validate stolen emails against TikTok and Instagram APIs, enabling targeted account attacks and dark web credential sales.