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);
     }
 }
Beispiel #2
0
  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' }
    ]);
  });
Beispiel #3
0
    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);
    }
Beispiel #4
0
	constructor (
		httpClient: HttpClient,
		ngZone: NgZone,
		router: Router,
		dialogService: DialogService,
		fileService: FileService
	) {
		router.resetConfig(appRoutes);

		resolveStaticServices({
			dialogService,
			fileService,
			httpClient,
			ngZone
		});
	}
Beispiel #5
0
	constructor (
		domSanitizer: DomSanitizer,
		httpClient: HttpClient,
		ngZone: NgZone,
		router: Router,
		databaseService: DatabaseService,
		dialogService: DialogService,
		fileService: FileService,
		localStorageService: LocalStorageService
	) {
		router.resetConfig(appRoutes);

		if (typeof testEnvironmentSetup === 'function') {
			testEnvironmentSetup(databaseService, localStorageService);
		}

		resolveStaticServices({
			dialogService,
			domSanitizer,
			fileService,
			httpClient,
			ngZone
		});
	}
 beforeEach(fakeAsync(() => {
   createComponent();
   loader = TestBed.get(NgModuleFactoryLoader);
   loader.stubbedModules = { expected: HeroModule };
   router.resetConfig([{path: 'heroes', loadChildren: 'expected'}]);
 }));
		store.let(appSelectors.getRoutes).subscribe(routes => {
			console.log(routes);
			router.resetConfig(routes);
		});
 private updateRouteConfig(config) {
     this.router.resetConfig(config);
     this.existingRoutes.next(this.routes);
 }