Ich bin neu in Angular. Ich möchte wissen, ob AngularJs verschachtelte Routen wie Emberjs unterstützt. Ich meine Routen wie diese: myappurl/#/company/:company_id/department/:department_id
9
Cherif BOUCHELAGHEM
9 Okt. 2012 im 01:58
3 Antworten
Beste Antwort
Gemäß dem im Dokument angegebenen Beispiel: https://docs.angularjs.org/api/ ngRoute / directive / ngView. Ja, Angularjs unterstützt es.
3
Ray Shan
18 Aug. 2014 im 00:40
Es ist erwähnenswert, dass es außer ui-router
noch andere Angular-Bibliotheken gibt, um diese Aufgabe auszuführen. Dieser funktioniert auch:
http://angular-route-segment.com
Es ist viel einfacher zu bedienen als UI-Router. Die Beispielroutenkonfiguration sieht folgendermaßen aus:
$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
artch
22 Aug. 2013 im 20:25
Es kann sich auch lohnen, https://github.com/angular-ui/ui-router
3
Leon Radley
25 März 2013 im 09:06