File tree Expand file tree Collapse file tree 3 files changed +10
-8
lines changed Expand file tree Collapse file tree 3 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,8 @@ angular.module('uiRouterSample', [
3
3
'uiRouterSample.contacts' ,
4
4
'uiRouterSample.contacts.service' ,
5
5
'uiRouterSample.utils.service' ,
6
- 'ui.router' ,
6
+ 'ui.router' ,
7
+ 'ui.router.default' ,
7
8
'ngAnimate'
8
9
] )
9
10
Original file line number Diff line number Diff line change @@ -11,9 +11,9 @@ angular.module('uiRouterSample.contacts', [
11
11
//////////////
12
12
. state ( 'contacts' , {
13
13
14
- // With abstract set to true, that means this state can not be explicitly activated.
15
- // It can only be implicitly activated by activating one of its children .
16
- abstract : true ,
14
+ // By specifying the name of a child state, when the abstract state is activated, it
15
+ // will activate the specified child state instead .
16
+ abstract : '.list' ,
17
17
18
18
// This abstract state will prepend '/contacts' onto the urls of all its children.
19
19
url : '/contacts' ,
Original file line number Diff line number Diff line change 14
14
< script src ="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.15/angular-animate.min.js "> </ script >
15
15
< script src ="//cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.14/angular-ui-router.min.js "> </ script >
16
16
17
+ < script src ="../angular-ui-router-default.js "> </ script >
18
+
17
19
<!-- app.js declares the uiRouterSample module and adds items to $rootScope, and defines
18
20
the "home" and "about" states
19
21
-->
45
47
< a class ="brand " ui-sref ="home "> ui-router</ a >
46
48
< ul class ="nav ">
47
49
48
- <!-- Here you can see ui-sref in action again. Also notice the use of $state.includes, which
49
- will set the links to 'active' if, for example on the first link, 'contacts' or any of
50
- its descendant states are activated. -->
51
- < li ng-class ="{active: $state.includes('contacts')} "> < a ui-sref ="contacts.list "> Contacts</ a > </ li >
50
+ <!-- Here you can see ui-sref in action again. The 'contacts state is abstract and will
51
+ transition to its default child state ('contacts.list'). -->
52
+ < li ui-sref-active ="active "> < a ui-sref ="contacts "> Contacts</ a > </ li >
52
53
< li ui-sref-active ="active "> < a ui-sref ="about "> About</ a > </ li >
53
54
</ ul >
54
55
You can’t perform that action at this time.
0 commit comments