首页 > 其他 > 详细

从flask视角理解angular(四)Route

时间:2017-10-01 12:04:02      阅读:227      评论:0      收藏:0      [点我收藏+]

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!