• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript router.provideRouter函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript router.provideRoutes函数代码示例发布时间:2022-05-28
下一篇:
TypeScript router.convertToParamMap函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap