How to use the @angular/router.provideRouter 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 lordfriend / Deneb / src / platform / browser-providers.ts View on Github external
import {disableDeprecatedForms, provideForms} from '@angular/forms';

import {appRoutes} from '../app/app.routes';

/*
* Application Providers/Directives/Pipes
* providers/directives/pipes that only live in our browser environment
*/
export const APPLICATION_PROVIDERS = [
  // new Angular 2 forms
  // disableDeprecatedForms(),
  // provideForms(),

  ...FORM_PROVIDERS,

  provideRouter(appRoutes),

  ...HTTP_PROVIDERS,

  { provide: LocationStrategy, useClass: HashLocationStrategy}
];

export const PROVIDERS = [
  ...APPLICATION_PROVIDERS
];
github justindujardin / ng2-material / modules / site / src / app / site.component.ts View on Github external
import { MdSidenav } from '@angular/material';
import {  Media } from 'ng2-material';
import { ComponentsComponent } from './+components';
import { IndexComponent } from './+index';
import { ComponentsService, IComponentMeta } from './shared/components.service';
import { FooterComponent } from './shared/footer/footer.component';
import { NavigationService } from './shared/navigation.service';
import { ComponentsOrderByPipe } from './site.pipe';

export const routes: RouterConfig = [
  {path: '', component: IndexComponent},
  {path: 'components/:id', component: ComponentsComponent}
];

export const AppRouterProviders = [
  provideRouter(routes)
];


@Component({
  moduleId: module.id,
  selector: 'site-app',
  templateUrl: 'site.component.html',
  styleUrls: ['site.component.css'],
  pipes: [ComponentsOrderByPipe],
  // directives: [
  //   ROUTER_DIRECTIVES, MATERIAL_DIRECTIVES, MD_SIDENAV_DIRECTIVES, MdIcon, MdToolbar,
  //   FooterComponent
  // ]
})
export class SiteAppComponent implements OnInit,
    OnDestroy, AfterViewInit {
github dharmeshpipariya-zz / md2 / src / app / main.ts View on Github external
import {AppComponent} from './app';
import {bootstrap} from '@angular/platform-browser-dynamic';
import {provide} from '@angular/core';
import {LocationStrategy, PathLocationStrategy } from '@angular/common';
import {provideRouter} from '@angular/router';
import {disableDeprecatedForms, provideForms} from '@angular/forms';
import {DIALOG_PROVIDERS} from '../components/dialog/dialog';
import {routes} from './routes';

bootstrap(AppComponent, [
  DIALOG_PROVIDERS,
  disableDeprecatedForms(),
  provideForms(),
  provideRouter(routes),
  provide(LocationStrategy, { useClass: PathLocationStrategy })
]);
github JacekKosciesza / InvestSystemsOrg / client / web / app / app.routes.js View on Github external
component: team_component_1.TeamComponent
    },
    {
        path: 'contact',
        component: contact_component_1.ContactComponent
    },
    {
        path: 'brokers',
        component: brokers_component_1.BrokersComponent
    },
    {
        path: 'yahoo-finance',
        component: yahoo_finance_component_1.YahooFinanceComponent
    },
]);
exports.APP_ROUTER_PROVIDER = router_1.provideRouter(exports.AppRoutes);
//# sourceMappingURL=app.routes.js.map
github sdmoralesma / javalab / javalab / src / main / webapp / app / main.routes.js View on Github external
"use strict";
var router_1 = require("@angular/router");
var app_component_1 = require("./app/app.component");
exports.routes = [
    { path: '', component: app_component_1.AppComponent },
    { path: ':lang', component: app_component_1.AppComponent }
];
exports.APP_ROUTER_PROVIDERS = [
    router_1.provideRouter(exports.routes)
];
//# sourceMappingURL=main.routes.js.map
github codeschool / WatchUsBuild-Angular2App / app / app.routes.ts View on Github external
import { provideRouter, RouterConfig } from '@angular/router'
import { RacesComponent } from './races.component'
import { ScoreboardComponent } from './scoreboard.component'
import { AboutComponent } from './about.component'

export const routes: RouterConfig = [
  { path: '', component: AboutComponent },
  { path: 'schedule', component: RacesComponent },
  { path: 'scoreboard', component: ScoreboardComponent }
]

export const APP_ROUTER_PROVIDERS = [
  provideRouter(routes)
]
github panacloud / learn-angular / step26_routing / app / app.routes.ts View on Github external
export const routes: RouterConfig = [
  {
    path: 'page1',
    component: Page1Component
  },
  {
    path: 'page2',
    component: Page2Component
  },
  { path: '', 
    component: Page1Component 
  }
];

export const APP_ROUTER_PROVIDERS = [
  provideRouter(routes)
];
github Promact / md2 / src / app / main.ts View on Github external
import {AppComponent} from './app';
import {bootstrap} from '@angular/platform-browser-dynamic';
import {provide} from '@angular/core';
import {LocationStrategy, PathLocationStrategy } from '@angular/common';
import {provideRouter} from '@angular/router';
import {disableDeprecatedForms, provideForms} from '@angular/forms';
import {DIALOG_PROVIDERS} from '../components/dialog/dialog';
import {routes} from './routes';

bootstrap(AppComponent, [
  DIALOG_PROVIDERS,
  disableDeprecatedForms(),
  provideForms(),
  provideRouter(routes),
  provide(LocationStrategy, { useClass: PathLocationStrategy })
]);
github SSWConsulting / enterprise-musicstore-ui-angular2 / src / SSW.MusicStore.Web / app / route.config.ts View on Github external
checkout: {
        path: 'checkout',
        as: 'checkout',
        component: CheckoutComponent
    },
    orders: {
        path: 'orders',
        as: 'orders',
        component: OrderComponent
    }
};

var routes = Object.keys(Routes).map(r => Routes[r]);

export const APP_ROUTER_PROVIDERS = [
    provideRouter(routes)
];