本文整理汇总了TypeScript中@angular/router.Routes类的典型用法代码示例。如果您正苦于以下问题:TypeScript Routes类的具体用法?TypeScript Routes怎么用?TypeScript Routes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Routes类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: updateRoutingInfo
function updateRoutingInfo(routes: Routes, path: string) {
routes.forEach(route => {
if(!route.data) { return; }
const fullLink = [path, route.path].join('/');
route.data.link = fullLink;
if(route.children) {
updateRoutingInfo(route.children, fullLink);
}
});
}
开发者ID:DevExpress,项目名称:SalesViewer,代码行数:10,代码来源:routes.service.ts
示例2: String
const flatten = (parent: Array<string>, routes: Routes): Array<Route> =>
routes.reduce(
(prev, route: AngularRoute & {server?: boolean}) => {
const prepared = location.prepareExternalUrl(parent.concat(route.path || []).join('/'));
const path = prepared.replace(/(^\.|\*\*?)/g, String()).split(/\//g).filter(v => v);
return prev.concat({path, server: route.server}, flatten(path, route.children || []));
},
empty);
开发者ID:sonukapoor,项目名称:angular-ssr,代码行数:10,代码来源:extract.ts
示例3:
import { Routes, RouterModule } from '@angular/router';
import { ServicesComponent } from './services.component';
const routes: Routes = [
{ path: 'services', component: ServicesComponent }
];
export const routing = RouterModule.forChild(routes);
export const routedComponents = routes.filter(r => r.component != undefined).map(r => r.component)
开发者ID:QuinntyneBrown,项目名称:hair-salon,代码行数:11,代码来源:services.routing.ts
示例4:
import { ModuleWithProviders } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ViewExpenseComponent } from './expenses/view-expense.component';
import { userRoutes } from './users/user-routes';
// Route Configuration
let routes: Routes = [
{
path: '',
redirectTo: '/users',
pathMatch: 'full'
},
{ path: 'expenses', component: ViewExpenseComponent }
];
routes = routes.concat(userRoutes);
// Deprecated provide
// export const APP_ROUTER_PROVIDERS = [
// provideRouter(routes)
// ];
export const routing: ModuleWithProviders = RouterModule.forRoot(routes);
开发者ID:darshanjani,项目名称:dj-practice,代码行数:23,代码来源:app.routes.ts
示例5:
import {Routes, RouterModule} from '@angular/router';
import {FleetMainComponent} from "./modules/fleet/fleet.component";
const navRoutes: Routes = [
{
path: 'fleet',
component: FleetMainComponent
}
];
const appRoutes: Routes = [
{
path: '',
redirectTo: '/fleet',
pathMatch: 'full'
}
];
export const routing = RouterModule.forRoot(appRoutes.concat(navRoutes));
开发者ID:torphexi,项目名称:Site,代码行数:20,代码来源:app.routing.ts
示例6: registerLocaleData
NgxChartsModule,
} from "@swimlane/ngx-charts";
registerLocaleData(localeGB);
export function JwtTokenGetter(): string {
return store.get("token");
}
const routes: Routes = [
{ path: "", redirectTo: "dashboard", pathMatch: "full" },
{ path: "dashboard", component: DashboardComponent, data: { title: "Dashboard", noDashboardLink: true } },
{ path: "edit", component: EditComponent, data: { title: "New Check" } },
{ path: "edit/:id", component: EditComponent, data: { title: "Edit Check" } },
{ path: "edit/:id/:copy", component: EditComponent, data: { title: "Copy Check" } },
{ path: "settings", component: SettingsComponent, data: { title: "Settings", noSettingsLink: true } },
{ path: "details/:id", component: DetailsComponent, data: { title: "Details" } },
{ path: "login", component: LoginComponent, data: { title: "Login", noDashboardLink: true } },
{ path: "user", component: UserComponent, data: { title: "User" } },
{ path: "init", component: InitComponent, data: { title: "SystemChecker Init", noDashboardLink: true } },
{ path: "**", component: PageNotFoundComponent, data: { title: "Not Found" } },
];
routes.forEach(x => {
if (!x.canDeactivate) {
x.canDeactivate = [];
}
x.canDeactivate.push(CanDeactivateGuard);
if (x.path === "login" || x.path === "init") { return; }
if (!x.canActivate) {
开发者ID:MattJeanes,项目名称:SystemChecker,代码行数:31,代码来源:app.module.ts
示例7:
mainMenuRoutes.forEach(r => routes.push({ path: r.path, component: r.component }));
开发者ID:asdman384,项目名称:tracker2,代码行数:1,代码来源:app.routing.module.ts
示例8:
import { TrainerComponent } from './trainer/trainer.component';
import { WinnerComponent } from './winner/winner.component';
import { AcknowledgeComponent } from './acknowledge/acknowledge.component';
import { TesterComponent } from './tester/tester.component';
const dev = false;
const routes: Routes = [
{ path: '', redirectTo: '/signin', pathMatch: 'full' },
{ path: 'home', component: HomeComponent },
{ path: 'board', component: BoardComponent },
{ path: 'starter', component: StarterPokemonComponent },
{ path: 'lobby', component: LobbyComponent },
{ path: 'capture', component: CapturePokemonComponent },
{ path: 'city', component: CityComponent },
{ path: 'event', component: EventComponent },
{ path: 'winner', component: WinnerComponent },
{ path: 'signin', component: SigninComponent },
{ path: 'trainer', component: TrainerComponent },
{ path: 'resumelobby', component: ResumeLobbyComponent },
{ path: 'acknowldedge', component: AcknowledgeComponent },
];
if ( dev ) { routes.push( { path: 'tester', component: TesterComponent } ); }
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
开发者ID:hiteshlala,项目名称:pokemon-board-game,代码行数:31,代码来源:app-routing.module.ts
注:本文中的@angular/router.Routes类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论