當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。