How to make nested Angularjs routes?

I'm new to angular, I want to know if angularjs supports nested routes like emberjs, such routes: myappurl/#/company/:company_id/department/:department_id

+7
source share
3 answers

According to the example given in the document: https://docs.angularjs.org/api/ngRoute/directive/ngView . Yes, Angularjs supports it.

+3
source

It is worth noting that there are other Angular libraries besides ui-router to complete this task. This also works:

http://angular-route-segment.com

This is much simpler than ui-router. An example route configuration is as follows:

 $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}); 
+7
source
+3
source

All Articles