当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript router.RouterModule类代码示例

本文整理汇总了TypeScript中@angular/router.RouterModule的典型用法代码示例。如果您正苦于以下问题:TypeScript RouterModule类的具体用法?TypeScript RouterModule怎么用?TypeScript RouterModule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了RouterModule类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1:

import { ModuleWithProviders } from '@angular/core';
import { RouterModule } from '@angular/router';

import * as view from './view/index';

export const appRouting: ModuleWithProviders = RouterModule.forRoot([
    { path: '', redirectTo: '/home', pathMatch: 'full' },
    { path: '', component: view.LayoutComponent, children: [
        { path: 'home', component: view.HomeComponent },
    ] }
], { enableTracing: false, useHash: true });

export const VIEWS: any[] = [
    view.LayoutComponent,
    view.HomeComponent
];
开发者ID:Cliveburr,项目名称:JavascriptLibrary,代码行数:16,代码来源:app.routing.ts

示例2:

/**
 * Created by slashhuang on 16/9/30.
 * 路由模块
 * 主程序入口提供路由服务,angular2目前在路由层面默认在topLevel需要定义router
 */

import { ModuleWithProviders }  from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
const mainRoutes: Routes = [
    {
        path:'',
        redirectTo:'',
        pathMatch:'full'
    }
];

export const AppRouting: ModuleWithProviders = RouterModule.forRoot(mainRoutes);

开发者ID:slashhuang,项目名称:ng2-tutorial,代码行数:17,代码来源:app.routing.ts

示例3:

import { ModuleWithProviders } from "@angular/core";
import { RouterModule } from "@angular/router";

import { SupportComponent } from "./support.component";

export const routing: ModuleWithProviders = RouterModule.forChild([
  { path: "support", component: SupportComponent},
]);
开发者ID:Strassengezwitscher,项目名称:Strassengezwitscher,代码行数:8,代码来源:support.routing.ts

示例4:

      { path: 'button', component: ButtonDemoComponent },
      { path: 'card', component: CardDemoComponent },
      { path: 'radio', component: RadioDemoComponent },
      { path: 'sidenav', component: SidenavDemoComponent },
      { path: 'slide-toggle', component: SlideToggleDemoComponent },
      { path: 'slider', component: SliderDemoComponent },
      { path: 'progress-circle', component: ProgressCircleDemoComponent },
      { path: 'progress-bar', component: ProgressBarDemoComponent },
      { path: 'portal', component: PortalDemoComponent },
      { path: 'overlay', component: OverlayDemoComponent },
      { path: 'checkbox', component: CheckboxDemoComponent },
      { path: 'input', component: InputDemoComponent },
      { path: 'toolbar', component: ToolbarDemoComponent },
      { path: 'icon', component: IconDemoComponent },
      { path: 'list', component: ListDemoComponent },
      { path: 'menu', component: MenuDemoComponent },
      { path: 'live-announcer', component: LiveAnnouncerDemoComponent },
      { path: 'gestures', component: GesturesDemoComponent },
      { path: 'grid-list', component: GridListDemoComponent },
      { path: 'tabs', component: TabsDemoComponent },
      { path: 'button-toggle', component: ButtonToggleDemoComponent },
      { path: 'baseline', component: BaselineDemoComponent },
      { path: 'ripple', component: RippleDemoComponent },
      { path: 'dialog', component: DialogDemoComponent },
      { path: 'tooltip', component: TooltipDemoComponent },
    ]
  }
];

export const demoRouting : ModuleWithProviders = RouterModule.forChild(demoRoutes);
开发者ID:padamshrestha,项目名称:angular2-material-seed,代码行数:30,代码来源:routes.ts

示例5:

import { RouterModule, Routes } from '@angular/router';
import { HomeComponent } from './components/home/home.component';
import { FuncionesComponent } from './components/funciones/funciones.component';
import { FuncionRangosComponent } from './components/funcion-rangos/funcion-rangos.component';


const APP_ROUTES: Routes = [
  { path: 'home', component: HomeComponent },
  { path: 'funciones', component: FuncionesComponent },
  { path: 'funcion-rangos/:index', component: FuncionRangosComponent },
  { path: '**', pathMatch: 'full', redirectTo: 'home' }
];

export const APP_ROUTING = RouterModule.forRoot(APP_ROUTES, {useHash:true});
开发者ID:alanymtza,项目名称:test,代码行数:14,代码来源:app.routes.ts

示例6:

import { Routes,RouterModule } from '@angular/router';
import { CourseComponent } from './course.component';
import { CourseListComponent } from './course-list.component';
import {PageNotFoundComponent } from '../pagenotfound.component';

const courseRoutes: Routes = [    
  { path: 'course', component: CourseComponent },
  {
    path: 'courselist',
    component: CourseListComponent,
    data: {
      title: 'Heroes List'
    }
  }
];

export const courseRoutingProviders: any[] = [

];

export const courseRouting = RouterModule.forChild(courseRoutes);
开发者ID:nemo97,项目名称:workspaces,代码行数:21,代码来源:course.routing.ts

示例7:

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

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

export const routing = RouterModule.forChild([
	{
		path: '',
		component: HomeComponent
	}
]);
开发者ID:joequah1,项目名称:itinerary-planner,代码行数:10,代码来源:home.routing.ts

示例8:

import {ModuleWithProviders} from "@angular/core"
import {FontAwesomeComponent} from "./+font-awesome/font-awesome.component";
import {GlyphiconsComponent} from "./+glyphicons/glyphicons.component";
import {FlagsComponent} from "./+flags/flags.component";
import {Routes, RouterModule} from "@angular/router";

export const iconsRoutes:Routes = [{
      path: 'font-awesome',
      component: FontAwesomeComponent
    },
    {
      path: 'glyphicons',
      component: GlyphiconsComponent

    },
    {
      path: 'flags',
      component: FlagsComponent
    }
  ];

export const iconsRouting = RouterModule.forChild(iconsRoutes);
开发者ID:Arne-Sandberg,项目名称:HawsIoT-WebApp,代码行数:22,代码来源:icons.routing.ts

示例9:

/**
 * Created by Martin on 11/08/16.
 */
import { Routes, RouterModule } from '@angular/router';

import { UserListComponent, UserDetailComponent } from './';
import { TopicListComponent } from '../topics';

const usersRoutes: Routes = [
    {
        path: 'users',
        component: UserListComponent,
        children: [
            { path: ':uuid', component: TopicListComponent },
            { path: '', component: UserDetailComponent }
        ]
    },

];

export const usersRouting = RouterModule.forChild(usersRoutes);
开发者ID:MBing,项目名称:ng2-simpletest,代码行数:21,代码来源:users.routing.ts

示例10:

/**
 * Created by stefania on 9/16/16.
 */
import { ModuleWithProviders }  from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

import { ResourceTypeListComponent } from "./resource-type-list.component";
import { ResourceTypeDetailsComponent } from "./resource-type-detail.component";
import { NewResourceTypeComponent } from "./new-resource-type.component";



const resourceTypesRoutes: Routes = [
    {
        path: 'resourceType',
        component: ResourceTypeListComponent
    },
    {
        path: 'resourceType/detail/:name',
        component: ResourceTypeDetailsComponent
    },
    {
        path: 'resourceType/new',
        component: NewResourceTypeComponent,
    },
];

export const resourceTypesRouting: ModuleWithProviders = RouterModule.forChild(resourceTypesRoutes);
开发者ID:antleb,项目名称:registry-core-gui,代码行数:28,代码来源:resource-type.routing.ts


注:本文中的@angular/router.RouterModule类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。