Complete the code to enable server-side rendering in an Angular app.
import { [1] } from '@angular/platform-server';
ServerModule is imported to enable Angular server-side rendering (SSR).
Complete the code to add Angular Universal for SSR in the app module.
@NgModule({ imports: [BrowserModule, [1]] }) export class AppModule {}ServerModule is added to the imports to enable SSR with Angular Universal.
Fix the error in the Angular Universal server main file to bootstrap the server app.
export { AppServerModule } from './app/app.server.module';
import { enableProdMode } from '@angular/core';
if (process.env.NODE_ENV === 'production') {
[1]();
}enableProdMode() is called to turn on production optimizations for SSR.
Fill both blanks to create a server-side rendered Angular app with Express.
import * as express from 'express'; import { ngExpressEngine } from '@nguniversal/express-engine'; import { AppServerModule } from './src/main.server'; const app = express(); app.engine('html', [1]({ bootstrap: [2] }));
ngExpressEngine is used as the engine, bootstrapping AppServerModule for SSR.
Fill all three blanks to improve SEO by pre-rendering Angular pages on the server.
app.get('*', (req, res) => { res.render('index', { req: req, res: res, [1]: true, [2]: 'en-US', [3]: 'My Angular SSR App' }); });
Setting serverSideRendering to true enables SSR, locale sets language, and documentTitle sets the page title for SEO.