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


TypeScript router.provideRouter函數代碼示例

本文整理匯總了TypeScript中@angular/router.provideRouter函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript provideRouter函數的具體用法?TypeScript provideRouter怎麽用?TypeScript provideRouter使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了provideRouter函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: bootstrap

import {bootstrap} from '@angular/platform-browser-dynamic'
import { provideRouter, RouterConfig } from '@angular/router';
import {LocationStrategy, HashLocationStrategy} from '@angular/common'
import {provide} from '@angular/core'
import {SimpleRouting} from './app.component'
import ComponentOne from './component-one';
import ComponentTwo from './component-two';
import ComponentThree from './component-three';
/*
@RouteConfig([
  {path: '/componentOne', as: 'ComponentOne', useAsDefault: true, component: ComponentOne},
  {path: '/componentTwo', as: 'ComponentTwo', useAsDefault: false, component: ComponentTwo},
  {path: '/componentThree/:message', as: 'ComponentThree', useAsDefault: false, component: ComponentThree}
  ])*/

const routes: RouterConfig = [
  {path: '/component-one',  useAsDefault: true, component: ComponentOne},
  {path: '/component-two',  useAsDefault: false, component: ComponentTwo},
  {path: '/component-three/:message',  useAsDefault: false, component: ComponentThree}
  ]
bootstrap(SimpleRouting, [provideRouter(routes), provide(LocationStrategy, {useClass: HashLocationStrategy})]);
開發者ID:andyglick,項目名稱:ngCourse2,代碼行數:21,代碼來源:index.ts

示例2: bootstrap

import { bootstrap }    from '@angular/platform-browser-dynamic';
import { provideRouter } from '@angular/router';
import { AppComponent } from './components/app.component';
import { appRoutes } from './components/app.routing';
import { disableDeprecatedForms, provideForms } from '@angular/forms';
import { HTTP_PROVIDERS } from '@angular/http';
import { AUTH_PROVIDERS } from 'angular2-jwt/angular2-jwt';

bootstrap(AppComponent, [
  disableDeprecatedForms(), // disable deprecated forms
  provideForms(),
  provideRouter(appRoutes), // enable new forms module
  AUTH_PROVIDERS,
  HTTP_PROVIDERS
])
.catch(err => console.log(`Error bootstrapping App ${err}`));

開發者ID:UncontrollableFrond,項目名稱:UnLoadX,代碼行數:16,代碼來源:main.ts

示例3: provideRouter

import { provideRouter, RouterConfig } from '@angular/router';

import { CustomersRoutes } from './customers/customers.routes';
import { CustomerRoutes } from './customer/customer.routes';

export const App_Routes: RouterConfig = [
  ...CustomersRoutes,
  ...CustomerRoutes,
  { path: '**', pathMatch:'full', redirectTo: '/customers' } //catch any unfound routes and redirect to home page
];

export const APP_ROUTER_PROVIDERS = [
  provideRouter(App_Routes)
];
開發者ID:GuyManDude,項目名稱:Angular2-JumpStart,代碼行數:14,代碼來源:app.routes.ts

示例4: provideRouter

import { provideRouter } from '@angular/router';

import { RecipesComponent } from './recipes';
import { ShoppingListComponent } from './shopping-list';
import { RECIPE_ROUTES } from './recipes/recipes.routes';

export const APP_ROUTES_PROVIDERS = [
	provideRouter([
		{
			path: '',
			redirectTo: '/recipes',
			pathMatch: 'full'
		},
		{
			path: 'recipes',
			component: RecipesComponent,
			children: RECIPE_ROUTES
		},
		{
			path: 'shopping-list',
			component: ShoppingListComponent
		}
	])
];
開發者ID:lordchancellor,項目名稱:recipe-book,代碼行數:24,代碼來源:app.routes.ts

示例5: bootstrap

import { HTTP_PROVIDERS } from '@angular/http';
import { bootstrap } from '@angular/platform-browser-dynamic';
import { disableDeprecatedForms, provideForms } from '@angular/forms'
import { EkApplication, EKAppRoutes } from './components/team.components'
import { TeamService } from './services/team.service'
import { provide } from '@angular/core'
import { provideRouter } from '@angular/router'
// import { ROUTER_PROVIDERS } from '@angular/router-deprecated'
import { LocationStrategy, HashLocationStrategy, PathLocationStrategy } from '@angular/common'
import { parent } from './components/form.components'


bootstrap(EkApplication, 
    [TeamService, 
    disableDeprecatedForms(), 
    provideRouter(EKAppRoutes),
    provideForms(),// ROUTER_PROVIDERS,
  //  provide(LocationStrategy, {useClass:HashLocationStrategy}),
    HTTP_PROVIDERS])
開發者ID:JohnGorter,項目名稱:Angular2_RC2_EK2016Demo,代碼行數:19,代碼來源:app.ts

示例6: enableProdMode

import { bootstrap } from '@angular/platform-browser-dynamic';
import { provideRouter } from '@angular/router';
import { enableProdMode } from '@angular/core';
import { disableDeprecatedForms, provideForms } from '@angular/forms';

import { AppComponent, environment } from './app/';
import { AppRoutes } from './app/app.routes';

if (environment.production) {
    enableProdMode();
}

bootstrap(AppComponent, [
    provideRouter(AppRoutes),
    disableDeprecatedForms(),
    provideForms()
]);
開發者ID:kevinaud,項目名稱:serverless-login,代碼行數:17,代碼來源:main.ts

示例7:

import {RouterConfig, provideRouter} from "@angular/router";

import {HelloComponent} from "./hello/hello";
import {CHILD_ROUTERS, CHILD_ROUTER_GUARDS} from "./childrouter/childrouter";
import {FORMS_ROUTERS} from "./forms/forms";

const routes: RouterConfig = [
    { path: "hello", component: HelloComponent },
    { path: "", redirectTo: "hello", pathMatch: "full" },

    ...FORMS_ROUTERS,
    ...CHILD_ROUTERS,

    { path: "**", redirectTo: "hello" },

];

const APP_ROUTER_PROVIDERS: any[] = [provideRouter(routes), CHILD_ROUTER_GUARDS];

export {

APP_ROUTER_PROVIDERS

};
開發者ID:zhaowenjunzz,項目名稱:StudyAngular2,代碼行數:24,代碼來源:app.routes.ts

示例8: provideRouter

import { provideRouter, RouterConfig } from '@angular/router';
import { LoginComponent } from './login/';
import { ChatComponent } from './chat/';


export const Routes: RouterConfig = [
    { path: 'login', component: LoginComponent },
    { path: 'chat', component: ChatComponent },
    { path: '', redirectTo: '/login' }
]

export const APP_ROUTER_PROVIDERS = [
    provideRouter(Routes)
];
開發者ID:maxamillion32,項目名稱:speed-challenge-1,代碼行數:14,代碼來源:app.routes.ts

示例9: enableProdMode

import 'babel-polyfill';
import 'core-js/es6';
import 'core-js/es7/reflect';
import 'ts-helpers';
import '../shims/shims_for_IE';
import 'zone.js/dist/zone';

import { enableProdMode } from '@angular/core';
import { bootstrap } from '@angular/platform-browser-dynamic';
import { RioSampleAppComponent } from './containers/sample-app';
import { provideRouter } from '@angular/router';
import { SAMPLE_APP_ROUTES } from './routes/sample-app';

declare const __PRODUCTION__: boolean;
declare const __TEST__: boolean;

if (__PRODUCTION__) {
  enableProdMode();
} else {
  require('zone.js/dist/long-stack-trace-zone');
}

if (!__TEST__) {
  bootstrap(RioSampleAppComponent, [
    provideRouter(SAMPLE_APP_ROUTES),
  ]);
}
開發者ID:BirajMishra,項目名稱:angular2-starter,代碼行數:27,代碼來源:index.ts

示例10: enableProdMode

import { FIREBASE_PROVIDERS, defaultFirebase} from 'angularfire2';
import {TestAppRoutes} from './app/app.routes'
// import { disableDeprecatedForms, provideForms } from '@angular/forms';
// import { routeConfig } from './app/routerconfigs/router.config';


if (environment.production) {
  enableProdMode();
}


bootstrap(AppComponent, [
  FIREBASE_PROVIDERS,
  // Initialize Firebase app
  defaultFirebase({
    apiKey: "AIzaSyD-XIYtmEXlQMy4uufzp_Mrxai253u_6fE",
    authDomain: "project-3617555751812177585.firebaseapp.com",
    databaseURL: "https://project-3617555751812177585.firebaseio.com",
    storageBucket: "project-3617555751812177585.appspot.com"
  }),
  // Initialize router:
  // Needs:
  //   imports for provideRouter here and RouterOutler in app.component.ts
  //   <router-outlet></router-outlet> tag in app.component.html
  //   RouteConfig array defined (ex in app.routes.ts)
  provideRouter(TestAppRoutes)
  // disableDeprecatedForms(),
  // provideForms()
])
.catch((err: any) => console.error(err));
開發者ID:SeekingMonkey,項目名稱:AngularFire2Test,代碼行數:30,代碼來源:main.ts


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