當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Router.resetConfig方法代碼示例

本文整理匯總了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);
     }
 }
開發者ID:NativeScript,項目名稱:nativescript-angular,代碼行數:11,代碼來源:app.routing.ts

示例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' }
    ]);
  });
開發者ID:LucasFrecia,項目名稱:store,代碼行數:25,代碼來源:lazy-load.spec.ts

示例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);
    }
開發者ID:anandsrivastav1087,項目名稱:pms,代碼行數:13,代碼來源:page.service.ts

示例4: constructor

	constructor (
		httpClient: HttpClient,
		ngZone: NgZone,
		router: Router,
		dialogService: DialogService,
		fileService: FileService
	) {
		router.resetConfig(appRoutes);

		resolveStaticServices({
			dialogService,
			fileService,
			httpClient,
			ngZone
		});
	}
開發者ID:cyph,項目名稱:cyph,代碼行數:16,代碼來源:app.module.ts

示例5: beforeEach

 beforeEach(fakeAsync(() => {
   createComponent();
   loader = TestBed.get(NgModuleFactoryLoader);
   loader.stubbedModules = { expected: HeroModule };
   router.resetConfig([{path: 'heroes', loadChildren: 'expected'}]);
 }));
開發者ID:BobChao87,項目名稱:angular,代碼行數:6,代碼來源:app.component.router.spec.ts

示例6:

		store.let(appSelectors.getRoutes).subscribe(routes => {
			console.log(routes);
			router.resetConfig(routes);
		});
開發者ID:bkirby989,項目名稱:WallaceTheme,代碼行數:4,代碼來源:app.component.ts

示例7: updateRouteConfig

 private updateRouteConfig(config) {
     this.router.resetConfig(config);
     this.existingRoutes.next(this.routes);
 }
開發者ID:j-thebault,項目名稱:angular-umd-dynamic-example,代碼行數:4,代碼來源:router.service.ts


注:本文中的@angular/router.Router.resetConfig方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。