angular/packages/platform-server/src/provide_server.ts
Kristiyan Kostadinov fc5d187da5 fix(platform-server): decouple server from animations module (#59762)
Removes the hard dependency between `platform-server` and `platform-browser/animations` since now the animations module will disable itself automatically.

PR Close #59762
2025-01-29 10:52:18 -08:00

34 lines
928 B
TypeScript

/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {EnvironmentProviders, makeEnvironmentProviders} from '@angular/core';
import {PLATFORM_SERVER_PROVIDERS} from './server';
/**
* Sets up providers necessary to enable server rendering functionality for the application.
*
* @usageNotes
*
* Basic example of how you can add server support to your application:
* ```ts
* bootstrapApplication(AppComponent, {
* providers: [provideServerRendering()]
* });
* ```
*
* @publicApi
* @returns A set of providers to setup the server.
*/
export function provideServerRendering(): EnvironmentProviders {
if (typeof ngServerMode === 'undefined') {
globalThis['ngServerMode'] = true;
}
return makeEnvironmentProviders([...PLATFORM_SERVER_PROVIDERS]);
}