[Angular 14] Providers in Angular Route

{
    path: 'admin',
    // load standalone component
    loadComponent: () => import('./feature/admin/admin.component').then(c => c.AdminComponent),
    // Swap UserLoaderService to ExperiemntalUserLoaderService for /admin route
    // This happen only for /admin route, Environment Injector Hierarchy 
    providers: [
        {provide: UserLoaderService, useExisting: ExperimentalUserLoaderService}
    ]    
}

 

Also you are able to use `Providers` in @Component, but it belongs to Node Injector Hierarchy.

posted @ 2022-06-22 13:56  Zhentiw  阅读(26)  评论(0编辑  收藏  举报