@angular/router#RouterModule TypeScript Examples

The following examples show how to use @angular/router#RouterModule. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: shared.module.ts    From one-platform with MIT License 6 votes vote down vote up
@NgModule({
  declarations: [
    AppLayoutComponent,
    OutlinedPieGraphComponent,
    LoaderComponent,
    LHCardLegendComponent,
    AvatarComponent,
    EmptyStateComponent,
    LHScoreLabelFormaterPipe,
    FilterListPipe,
    ContextSelectorComponent,
    UrlValidatorDirective,
    FormErrorMessageComponent,
    TableComponent,
    GetDecimalPipe,
    FloorPipe,
  ],
  imports: [CommonModule, RouterModule],
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
  exports: [
    AppLayoutComponent,
    OutlinedPieGraphComponent,
    LoaderComponent,
    LHCardLegendComponent,
    AvatarComponent,
    EmptyStateComponent,
    LHScoreLabelFormaterPipe,
    FilterListPipe,
    ContextSelectorComponent,
    UrlValidatorDirective,
    FormErrorMessageComponent,
    TableComponent,
    GetDecimalPipe,
    FloorPipe
  ],
})
export class SharedModule {}
Example #2
Source File: settings-routing.module.ts    From Uber-ServeMe-System with MIT License 6 votes vote down vote up
@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule],
})
export class SettingsPageRoutingModule {

  constructor(public nav: NavController) {
  }

  goRoot(){
    this.nav.navigateRoot(['/home']);
  }
}
Example #3
Source File: app.module.ts    From Angular-Computer-Vision-Azure-Cognitive-Services with MIT License 6 votes vote down vote up
@NgModule({
  declarations: [
    AppComponent,
    OcrComponent,
    NavMenuComponent,
    HomeComponent
  ],
  imports: [
    BrowserModule,
    HttpClientModule,
    FormsModule,
    RouterModule.forRoot([
      { path: '', component: HomeComponent, pathMatch: 'full' },
      { path: 'computer-vision-ocr', component: OcrComponent },
    ], { relativeLinkResolution: 'legacy' })
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
Example #4
Source File: app-routing.module.ts    From DocumentationWebPage with MIT License 6 votes vote down vote up
@NgModule({
    imports: [
        RouterModule.forRoot(appRoutes) 
    ],
    exports: [
        RouterModule 
    ]
})
export class AppRoutingModule { }
Example #5
Source File: app-routing.module.ts    From xBull-Wallet with GNU Affero General Public License v3.0 6 votes vote down vote up
@NgModule({
  imports: [RouterModule.forRoot(routes, {
    useHash: environment.platform !== 'website',
    preloadingStrategy: PreloadAllModules,
    // enableTracing: !environment.production
  })],
  exports: [RouterModule]
})
export class AppRoutingModule { }
Example #6
Source File: app-routing.module.ts    From rubic-app with GNU General Public License v3.0 6 votes vote down vote up
@NgModule({
  imports: [
    RouterModule.forRoot(routes, {
      onSameUrlNavigation: 'reload',
      relativeLinkResolution: 'legacy'
    })
  ],
  exports: [RouterModule]
})
export class AppRoutingModule {}
Example #7
Source File: app-routing.module.ts    From Angular-ActionStreams with MIT License 6 votes vote down vote up
@NgModule({
  imports: [
    RouterModule.forRoot([
    { path: 'welcome', component: WelcomeComponent },
    {
        path: 'products',
        data: { preload: false },
        loadChildren: () => import('./products/product.module').then(m => m.ProductModule)
    },
    { path: '', redirectTo: 'welcome', pathMatch: 'full' },
    { path: '**', component: PageNotFoundComponent }
], { relativeLinkResolution: 'legacy' })
  ],
  exports: [RouterModule]
})
export class AppRoutingModule { }
Example #8
Source File: app-routing.module.ts    From Angular-HigherOrderMapping with MIT License 6 votes vote down vote up
@NgModule({
  imports: [
    RouterModule.forRoot([
      { path: 'welcome', component: WelcomeComponent },
      {
        path: 'products',
        data: { preload: false },
        loadChildren: () =>
          import('./products/product.module').then(m => m.ProductModule)
      },
      { path: '', redirectTo: 'welcome', pathMatch: 'full' },
      { path: '**', component: PageNotFoundComponent }
    ])
  ],
  exports: [RouterModule]
})
export class AppRoutingModule { }
Example #9
Source File: accordion.module.ts    From angular-electron-admin with Apache License 2.0 6 votes vote down vote up
@NgModule({
  declarations: [
    AccordionComponent
  ],
  imports: [
    CommonModule,
    BsDropdownModule.forRoot(),
    AccordionModule.forRoot(),
    RouterModule.forChild(ACCORDION_ROUTES)
  ],
  providers: [
    AccordionService
  ]
})
export class AccordionComponentModule {
}
Example #10
Source File: home.module.ts    From dbm with Apache License 2.0 6 votes vote down vote up
@NgModule({
  imports: [
    FormsModule,
    ChartModule,
    CommonModule,
    ServiceModule,
    NgZorroAntdModule,
    CommonShareModule,
    RouterModule.forChild(HOME_ROUTES),
    TranslateModule
  ],
  exports: [],
  declarations: [
    HomeComponent
  ],
  providers: [
    DatasourceService,
    QueryService,
    ClickhousePluginService
  ]
})
export class HomeModule {
}
Example #11
Source File: authentication-routing.module.ts    From ng-conf-2020-workshop with MIT License 6 votes vote down vote up
@NgModule({
    imports: [
      RouterModule.forChild(authRoutes)
    ],
    exports: [
      RouterModule
    ]
  })
export class AuthenticationRoutingModule {}
Example #12
Source File: app-routing.module.ts    From canopy with Apache License 2.0 6 votes vote down vote up
@NgModule({
  imports: [
    RouterModule.forRoot(routes, {
    useHash: true,
    relativeLinkResolution: 'legacy'
}),
  ],
  exports: [RouterModule],
})
export class AppRoutingModule {}
Example #13
Source File: app.module.ts    From mslearn-live-azure-fundamentals with MIT License 6 votes vote down vote up
@NgModule({
  declarations: [
    AppComponent,
    ProductsListComponent,
    AdminProductsListComponent,
    ProductComponent,
    AdminProductComponent,
    AboutComponent,
    NavmenuComponent,
  ],
  imports: [
    BrowserModule,
    HttpClientModule,
    AppRoutingModule,
    ReactiveFormsModule,
    RouterModule.forRoot([
      { path: 'home', component: AboutComponent },
      { path: 'product/:productId', component: ProductComponent },
      { path: 'products', component: ProductsListComponent },
      { path: 'admin/products', component: AdminProductsListComponent },
      { path: 'admin/product/:productId', component: AdminProductComponent },
      { path: '**', redirectTo: 'home' }
    ])
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
Example #14
Source File: header.component.spec.ts    From mylog14 with GNU General Public License v3.0 6 votes vote down vote up
describe('HeaderComponent', () => {
  let component: HeaderComponent;
  let fixture: ComponentFixture<HeaderComponent>;

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [ HeaderComponent ],
      imports: [
        IonicModule.forRoot(),
        RouterModule.forRoot([]),
      ]
    }).compileComponents();

    fixture = TestBed.createComponent(HeaderComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  }));

  it('should create', () => {
    expect(component).toBeTruthy();
  });
});
Example #15
Source File: app.module.ts    From ng-spotify-importer with GNU General Public License v3.0 6 votes vote down vote up
@NgModule({
    imports: [
        BrowserModule,
        RouterModule.forRoot([], { relativeLinkResolution: 'legacy' }),
        FormsModule,
        BrowserAnimationsModule,
        MatDialogModule,
        HttpClientModule,
    ],
    declarations: [
        AppComponent,
        SpotifyAuthComponent,
        PlaylistEditorComponent,
        FileReaderComponent,
        NotificationComponent,
        SongDetailsComponent,
        CleanupUnknownSongsHelpComponent
    ],
    providers: [
        { provide: 'SpotifyWebApiJs', useClass: SpotifyWebApi }
    ],
    bootstrap: [AppComponent]
})
export class AppModule {
}
Example #16
Source File: app-routing.module.ts    From msfs-community-downloader with GNU Affero General Public License v3.0 6 votes vote down vote up
@NgModule({
    imports: [
        RouterModule.forRoot(routes, { relativeLinkResolution: 'legacy' }),
        HomeRoutingModule,
        ListEditorRoutingModule,
        SettingsRoutingModule
    ],
    exports: [RouterModule]
})
export class AppRoutingModule { }
Example #17
Source File: app-routing.module.ts    From barista with Apache License 2.0 6 votes vote down vote up
@NgModule({
  imports: [
    RouterModule.forRoot(routes, {
    onSameUrlNavigation: 'reload',
    relativeLinkResolution: 'legacy'
}),
  ],
  exports: [RouterModule],
})
export class AppRoutingModule {}
Example #18
Source File: app.module.ts    From OrchardSkills.OrchardCore.Headless with MIT License 6 votes vote down vote up
@NgModule({
  declarations: [
    AppComponent,
    NavbarComponent,
    BlogContentComponent,
    BlogComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    RouterModule,
    GraphQLModule,
    HttpClientModule,
    NgxPaginationModule,
    HttpClientModule,
    MarkdownModule.forRoot({
      loader: HttpClient,
      markedOptions: {
        provide: MarkedOptions,
        useValue: {
          gfm: true,
          tables: true,
          breaks: true,
          pedantic: false,
          sanitize: true,
          smartLists: true,
          smartypants: true,
        }
      }
    }),
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
Example #19
Source File: app-routing.module.ts    From Angular-Cookbook with MIT License 6 votes vote down vote up
@NgModule({
  imports: [
    RouterModule.forRoot(routes, {
      useHash: true,
      relativeLinkResolution: 'legacy',
    }),
  ],
  exports: [RouterModule],
})
export class AppRoutingModule {}
Example #20
Source File: app-routing.module.ts    From one-platform with MIT License 5 votes vote down vote up
@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule],
})
export class AppRoutingModule {}
Example #21
Source File: app-routing.module.ts    From 1hop with MIT License 5 votes vote down vote up
@NgModule({
    imports: [RouterModule.forRoot(routes)],
    exports: [RouterModule]
})
export class AppRoutingModule {
}
Example #22
Source File: app-routing.module.ts    From 1x.ag with MIT License 5 votes vote down vote up
@NgModule({
    imports: [RouterModule.forRoot(routes)],
    exports: [RouterModule]
})
export class AppRoutingModule {
}
Example #23
Source File: app-routing.module.ts    From gnosis.1inch.exchange with MIT License 5 votes vote down vote up
@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule {
}
Example #24
Source File: app-routing.module.ts    From Uber-ServeMe-System with MIT License 5 votes vote down vote up
@NgModule({
  imports: [
    RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
  ],
  exports: [RouterModule]
})
export class AppRoutingModule {}