W3cubDocs

/Angular 11

ANALYZE_FOR_ENTRY_COMPONENTS

const deprecated

A DI token that you can use to create a virtual provider that will populate the entryComponents field of components and NgModules based on its useValue property value. All components that are referenced in the useValue value (either directly or in a nested array or map) are added to the entryComponents property.

Deprecated: Since 9.0.0. With Ivy, this property is no longer necessary.

const ANALYZE_FOR_ENTRY_COMPONENTS: InjectionToken<any>;

Usage notes

The following example shows how the router can populate the entryComponents field of an NgModule based on a router configuration that refers to components.

// helper function inside the router
function provideRoutes(routes) {
  return [
    {provide: ROUTES, useValue: routes},
    {provide: ANALYZE_FOR_ENTRY_COMPONENTS, useValue: routes, multi: true}
  ];
}

// user code
let routes = [
  {path: '/root', component: RootComp},
  {path: '/teams', component: TeamsComp}
];

@NgModule({
  providers: [provideRoutes(routes)]
})
class ModuleWithRoutes {}

© 2010–2021 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v11.angular.io/api/core/ANALYZE_FOR_ENTRY_COMPONENTS