码迷,mamicode.com
首页 > 其他好文 > 详细

从flask视角理解angular(四)Route

时间:2017-10-01 12:24:20      阅读:117      评论:0      收藏:0      [点我收藏+]

标签:正则表达式   集中   export   detail   com   style   esc   path   pre   

app-routing.modules.ts

 

import { NgModule }             from ‘@angular/core‘;
import { RouterModule, Routes } from ‘@angular/router‘;

import { DashboardComponent }   from ‘./dashboard.component‘;
import { HeroesComponent }      from ‘./heroes.component‘;
import { HeroDetailComponent }  from ‘./hero-detail.component‘;

const routes: Routes = [
  { path: ‘‘, redirectTo: ‘/dashboard‘, pathMatch: ‘full‘ },
  { path: ‘dashboard‘,  component: DashboardComponent },
  { path: ‘detail/:id‘, component: HeroDetailComponent },
  { path: ‘heroes‘,     component: HeroesComponent }
];

@NgModule({
  imports: [ RouterModule.forRoot(routes) ],
  exports: [ RouterModule ]
})
export class AppRoutingModule {}

 

类似django的方式,在urls.py里集中管理

urlpatterns = patterns(视图前缀,  
    url(r^正则表达式1/$, 视图函数1, name="url标识1"),  
    url(r^正则表达式2/$, 视图函数2, name="url标识2"),  
)  

 

从flask视角理解angular(四)Route

标签:正则表达式   集中   export   detail   com   style   esc   path   pre   

原文地址:http://www.cnblogs.com/xuanmanstein/p/7616860.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!