本文整理汇总了TypeScript中@angular/router.Router.resetConfig方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Router.resetConfig方法的具体用法?TypeScript Router.resetConfig怎么用?TypeScript Router.resetConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/router.Router
的用法示例。
在下文中一共展示了Router.resetConfig方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(private router: Router) {
if (AppModule.root === "page-router" || AppModule.root === "page-router-modal") {
this.router.resetConfig(routes);
} else if (AppModule.root === "layout" || AppModule.root === "layout-modal") {
this.router.resetConfig(routesLayout);
} else if (AppModule.root === "named-page-router" || AppModule.root === "named-page-router-modal") {
this.router.resetConfig(namedOutletRoutes);
} else if(AppModule.root === "tab" || AppModule.root === "tab-modal"){
this.router.resetConfig(routesTab);
}
}
示例2: beforeEach
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
RouterTestingModule,
NgxsModule.forRoot([]),
NgxsModule.forFeature([CounterState])
],
declarations: [MyComponent],
providers: [MathService]
});
router = TestBed.get(Router);
const loader: SpyNgModuleFactoryLoader = TestBed.get(NgModuleFactoryLoader);
loader.stubbedModules = {
lazyModule: MyLazyModule,
secondLazyModule: SecondLazyModule
};
router.resetConfig([
{ path: 'todos', loadChildren: 'lazyModule' },
{ path: 'simple', loadChildren: 'secondLazyModule' }
]);
});
示例3: addNewPages
addNewPages(newPages: IPage[], componentType: any) {
//lets first reset the pages array to basePages
this.pages = this.basePages;
let routerConfig = this.router.config
newPages.forEach(p => {
routerConfig.unshift({ path: p.route, component: componentType });
});
this.router.resetConfig(routerConfig);
this.pages = this.pages.concat(newPages);
}
示例4: constructor
constructor (
httpClient: HttpClient,
ngZone: NgZone,
router: Router,
dialogService: DialogService,
fileService: FileService
) {
router.resetConfig(appRoutes);
resolveStaticServices({
dialogService,
fileService,
httpClient,
ngZone
});
}
示例5: beforeEach
beforeEach(fakeAsync(() => {
createComponent();
loader = TestBed.get(NgModuleFactoryLoader);
loader.stubbedModules = { expected: HeroModule };
router.resetConfig([{path: 'heroes', loadChildren: 'expected'}]);
}));
示例6:
store.let(appSelectors.getRoutes).subscribe(routes => {
console.log(routes);
router.resetConfig(routes);
});
示例7: updateRouteConfig
private updateRouteConfig(config) {
this.router.resetConfig(config);
this.existingRoutes.next(this.routes);
}