本文整理汇总了TypeScript中@angular/router.RouterModule.forChild方法的典型用法代码示例。如果您正苦于以下问题:TypeScript RouterModule.forChild方法的具体用法?TypeScript RouterModule.forChild怎么用?TypeScript RouterModule.forChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/router.RouterModule
的用法示例。
在下文中一共展示了RouterModule.forChild方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
import {AboutComponent} from "./about.component";
import {RouterModule} from "@angular/router";
const routes = [
{path: '', component: AboutComponent}
];
export default RouterModule.forChild(routes);
示例2:
import { ModuleWithProviders } from '@angular/core';
import { RouterModule } from '@angular/router';
import { WarehouseCmp } from './warehouse';
import { WarehouseDetailCmp} from './detail/detail';
import { WarehouseImportCmp } from './import/import';
export const routing: ModuleWithProviders = RouterModule.forChild([
{ path: 'warehouse', component: WarehouseCmp },
{path: 'warehouse-detail/:id', component: WarehouseDetailCmp },
{path: 'warehouse-import', component: WarehouseImportCmp },
]);
示例3:
import { NgModule } from '@angular/core';
import { CommonModule, } from '@angular/common';
import { Routes, RouterModule } from '@angular/router';
import { ModuleWithProviders } from '@angular/core';
import {AboutComponent} from './about.component';
const routes: Routes =[
{path: '',
component: AboutComponent,
children: [
{ path: '', redirectTo: 'home', pathMatch: 'full' },
{path: '**', redirectTo: 'home' }
]
}
];
export const routing = RouterModule.forChild(routes);
示例4:
{
path: 'crisis-center',
component: CrisisCenterComponent,
children: [
// #docregion admin-route
{
path: 'admin',
component: CrisisAdminComponent,
canActivate: [AuthGuard]
},
// #enddocregion admin-route
// #docregion crisis-detail-resolve
{
path: ':id',
component: CrisisDetailComponent,
canDeactivate: [CanDeactivateGuard],
resolve: {
crisis: CrisisDetailResolve
}
},
// #enddocregion crisis-detail-resolve
{
path: '',
component: CrisisListComponent
}
]
}
];
export const crisisCenterRouting: ModuleWithProviders = RouterModule.forChild(crisisCenterRoutes);
示例5:
import { RouterModule, Routes } from '@angular/router';
import { AirexchangeFormComponent } from './airexchange-form/airexchange-form.component';
const routes: Routes = [
{ path: '', component: AirexchangeFormComponent }
];
export const AirexchangeRoutes = RouterModule.forChild(routes);
示例6:
import { ModuleWithProviders } from '@angular/core';
import { RouterModule } from '@angular/router';
import { ContactComponent } from './contact.component.3';
export const routing: ModuleWithProviders = RouterModule.forChild([
{ path: 'contact', component: ContactComponent}
]);
示例7:
import { ModuleWithProviders } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ChildCheckinComponent } from './child-checkin.component';
import { RoomComponent } from './room';
const childCheckinRoutes: Routes = [
{
path: 'child-checkin',
component: ChildCheckinComponent,
children: [
{
path: 'room',
component: RoomComponent
},
]
}
];
export const childCheckinRouting: ModuleWithProviders = RouterModule.forChild(childCheckinRoutes);
示例8:
loadChildren: "../pages/agentAnalytics/agentAnalytics.module#AgentAnalyticsModule"
},
{
path: "usersdata",
loadChildren: "../pages/leads/leads.module#LeadsModule"
},
{
path: "support",
loadChildren: "../pages/support/support.module#SupportModule"
},
//---------------------------------------------------------->
//Page Layouts
//---------------------------------------------------------->
//
//---------------------------------------------------------->
//Helper Classes
//---------------------------------------------------------->
{
path: "helper-classes",
loadChildren: "../pages/helper-classes/helper-classes.module#HelperClassesModule"
}
]
},
// 404 Page Not Found
{ path: "**", redirectTo: "dashboards" }
];
export const LayoutRoutes = RouterModule.forChild(LAYOUT_ROUTES);
示例9:
import { ModuleWithProviders } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { DashboardComponent } from './ss-dashboard.component';
export const routing: ModuleWithProviders = RouterModule.forChild([
{ path: 'dashboard', component: DashboardComponent}
]);
示例10:
import { ModuleWithProviders } from '@angular/core';
import { RouterModule } from '@angular/router';
import { BootstrapDemo } from './bootstrap-demo';
import { BootstrapDemoPage } from './bootstrap-demo-page/bootstrap-demo-page';
import { ModalCustomisationWizard } from './modal-customisation-wizard/modal-customisation-wizard';
export const routing: ModuleWithProviders = RouterModule.forChild([
{ path: 'bootstrap-demo', component: BootstrapDemo, children: [
{ path: '', component: BootstrapDemoPage, terminal: true },
// { path: 'customizeModals', component: ModalCustomisationWizard }
]
}
]);