How to use the @angular/router.RouterModule.forRoot function in @angular/router

To help you get started, we’ve selected a few @angular/router examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github locdb / locdb-frend / src / app / edit-view / edit-view.component.spec.ts View on Github external
beforeEach(async(() => {
    TestBed.configureTestingModule({
      imports: [
        TypeaheadModule.forRoot(),
        HttpModule,
        HttpClientModule,
        BrowserModule,
        FormsModule,
        ReactiveFormsModule,
        RouterModule.forRoot(
          appRoutes,
          {enableTracing: true }
        )
      ],
      declarations: [ EditViewComponent,
        ResourceFormComponent,
        EntryFormComponent,
        ],
      providers: [
        { provide: BASE_PATH, useValue: environment.locdbUrl},
        // below: for karma/jasmine purposes
        { provide: APP_BASE_HREF, useValue: 'localhost:9876'},
        LocdbService,
        ScanService,
        UserService,
        BibliographicEntryService,
github shlomiassaf / angular-library-starter / src / demo / app / app.module.ts View on Github external
*/
@NgModule({
  bootstrap: [ AppComponent ],
  declarations: [
    AppComponent,
    HomeComponent,
    NoContentComponent
  ],
  /**
   * Import Angular's modules.
   */
  imports: [
    BrowserModule,
    FormsModule,
    HttpModule,
    RouterModule.forRoot(ROUTES, { useHash: true, preloadingStrategy: PreloadAllModules }),
    MyLibModule
  ],
  /**
   * Expose our Services and Providers into Angular's dependency injection.
   */
  providers: [
    environment.ENV_PROVIDERS,
    APP_PROVIDERS
  ]
})
export class AppModule { }
github vmware / clarity / src / ks-app / src / app / app-routing.module.ts View on Github external
{ path: 'killers/sams-town', component: KSSamsTownDemo, data: { state: 'sams-town' } },
      { path: 'wikipedia', component: KSWikipediaDemo, data: { state: 'wikipedia' } },
    ],
  },
  { path: 'dropdowns', component: KSDropdowns, data: { state: 'dropdowns' } },
  { path: 'signposts', component: KSSignposts, data: { state: 'signposts' } },
  { path: 'tooltips', component: KSTooltips, data: { state: 'tooltips' } },
  { path: 'typography', component: KSTypography, data: { state: 'typography' } },
  { path: 'wizards', component: KSWizards, data: { state: 'wizards' } },
  { path: 'progress-bars', component: KSProgressBars, data: { state: 'progress-bars' } },
  { path: 'spinners', component: KSSpinners, data: { state: 'spinners' } },
  { path: 'tables', component: KSTables, data: { state: 'tables' } },
  { path: 'treeview', component: KSTreeview, data: { state: 'treeview' } },
];

@NgModule({ imports: [RouterModule.forRoot(routes)], exports: [RouterModule] })
export class AppRoutingModule {}
github SchweizerischeBundesbahnen / scion-workbench / projects / app / workbench-application-platform / host-app / src / app / app.module.ts View on Github external
symbolicName: 'devtools-app',
          manifestUrl: environment.devtools_app_manifest_url,
          scopeCheckDisabled: true,
        },
        {
          symbolicName: 'testing-app',
          exclude: !environment.testing_app_manifest_url,
          manifestUrl: environment.testing_app_manifest_url,
        },
        {
          symbolicName: 'angular-io-app',
          manifestUrl: '/assets/angular-io-manifest.json',
        },
      ],
    }),
    RouterModule.forRoot([], {useHash: true}),
    BrowserAnimationsModule,
    BrowserModule,
    CustomExtensionModule,
  ],
  bootstrap: [
    AppComponent,
  ],
})
export class AppModule {
}
github totvs / thf-conference-sample / thf-sample-web-conference / src / app / app-routing.module.ts View on Github external
path: 'speakers',
        children: [
          { path: '', component: SpeakerComponent },
          { path: 'create', component: SpeakerEditComponent },
          { path: 'detail/:id', component: SpeakerDetailComponent },
          { path: 'edit/:id', component: SpeakerEditComponent }
        ]
      },
      { path: 'tracks', loadChildren: 'app/track/track.module#TrackModule' },
      { path: '**', redirectTo: '/home', pathMatch: 'full'}
    ]
  }
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }
github jlooper / developer-expert-hub / src / app / app.routing.ts View on Github external
import { ModuleWithProviders }  from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

import { HomeComponent } from './home/home.component';
import { PageNotFoundComponent } from './app.component';

const appRoutes: Routes = [
  { path: '', component: HomeComponent },
  { path: '**', component: PageNotFoundComponent },
];

export const AppRouting: ModuleWithProviders = RouterModule.forRoot(appRoutes);
github xiyuan-fengyu / ppspider / ui / src / app / app-routing.module.ts View on Github external
{
    path: "icons",
    component: IconsComponent
  },
  {
    path: "dataUi/:className",
    component: DataUiComponent
  },
  {
    path: "**",
    redirectTo: "queueInfo",
  }
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule],
  providers: [
    {
      provide: RouteReuseStrategy,
      useClass: CacheRouteReuseStrategy
    }
  ]
})
export class AppRoutingModule { }
github fisenkodv / itinerary / src / app / app-router.module.ts View on Github external
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';

import { NotFoundPageComponent } from './modules/core/containers/not-found-page/not-found-page.component';

const routes: Routes = [
  { path: '', redirectTo: '/places', pathMatch: 'full' },
  {
    path: 'places',
    loadChildren: './modules/places/places.module#PlacesModule',
  },
  { path: '**', component: NotFoundPageComponent },
];

@NgModule({
  imports: [RouterModule.forRoot(routes, { useHash: false })]
})
export class AppRouterModule {}
github phodal / aofe.code / chapter08 / mooa-examples / mooa-hosts / src / app / app.module.ts View on Github external
import {AppRoutingModule} from './app-routing.module';
import {AppComponent} from './app.component';
import {HttpClientModule} from '@angular/common/http';
import {RouterModule} from '@angular/router';
import { HomeComponent } from './home/home.component';

@NgModule({
  declarations: [
    AppComponent,
    HomeComponent
  ],
  imports: [
    BrowserModule,
    HttpClientModule,
    AppRoutingModule,
    RouterModule.forRoot([
      {
        path: 'app/:appName/:route',
        component: AppComponent
      },
      {
        path: 'app/:appName',
        component: AppComponent
      },
    ])
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule {
}
github fgladisch / angular2-webpack-seed / src / app / app.component.spec.ts View on Github external
beforeEach(() => {
    TestBed.configureTestingModule({
      declarations: [
        AppComponent,
        NavigationComponent
      ],
      imports: [
        BrowserModule,
        TranslateModule,
        NgbModule.forRoot(),
        RouterModule.forRoot([])
      ],
      providers: [
        { provide: TranslateService, useClass: MockTranslateService },
        { provide: APP_BASE_HREF, useValue: '/' },
        AppComponent
      ]
    });
    fixture = TestBed.createComponent(AppComponent);
    component = fixture.componentInstance;
  });