const
A DI token representing a string ID, used primarily for prefixing application attributes and CSS styles when ViewEncapsulation#Emulated
is being used.
const APP_ID: InjectionToken<string>;
The token is needed in cases when multiple applications are bootstrapped on a page (for example, using bootstrapApplication
calls). In this case, ensure that those applications have different APP_ID
value setup. For example:
bootstrapApplication(ComponentA, { providers: [ { provide: APP_ID, useValue: 'app-a' }, // ... other providers ... ] }); bootstrapApplication(ComponentB, { providers: [ { provide: APP_ID, useValue: 'app-b' }, // ... other providers ... ] });
By default, when there is only one application bootstrapped, you don't need to provide the APP_ID
token (the ng
will be used as an app ID).
© 2010–2023 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://angular.io/api/core/APP_ID