Che*_*HEM 7 javascript url-routing angularjs
我是角度新手,我想知道angularjs是否支持像emberjs这样的嵌套路线我的意思是这样的路线: myappurl/#/company/:company_id/department/:department_id
值得一提的是,除了ui-router
完成这项任务外,还有另一个Angular库.这个也有效:
http://angular-route-segment.com
它比ui-router更简单易用.示例路由配置如下所示:
$routeSegmentProvider.
when('/section1', 's1.home').
when('/section1/prefs', 's1.prefs').
when('/section1/:id', 's1.itemInfo.overview').
when('/section1/:id/edit', 's1.itemInfo.edit').
when('/section2', 's2').
segment('s1', {
templateUrl: 'templates/section1.html',
controller: MainCtrl}).
within().
segment('home', {
templateUrl: 'templates/section1/home.html'}).
segment('itemInfo', {
templateUrl: 'templates/section1/item.html',
controller: Section1ItemCtrl,
dependencies: ['id']}).
within().
segment('overview', {
templateUrl: 'templates/section1/item/overview.html'}).
segment('edit', {
templateUrl: 'templates/section1/item/edit.html'}).
up().
segment('prefs', {
templateUrl: 'templates/section1/prefs.html'}).
up().
segment('s2', {
templateUrl: 'templates/section2.html',
controller: MainCtrl});
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
25436 次 |
最近记录: |