Angular requires a platform to be initialized. This error is thrown when bootstrapApplication
is used on the server without providing a BootstrapContext
.
When using server-side rendering, bootstrapApplication
requires a BootstrapContext
to be passed as an argument.
Debugging the error
To resolve this error, ensure that your main.server.ts
file correctly passes a BootstrapContext
to the bootstrapApplication
function.
import { bootstrapApplication, BootstrapContext } from '@angular/platform-browser';import { App } from './app/app';import { config } from './app/app.config.server';const bootstrap = (context: BootstrapContext) => bootstrapApplication(App, config, context);export default bootstrap;