Skip to content

Commit 9a5fff7

Browse files
committed
Updated sample to use angular-ui-router-default.js.
1 parent 71aaae9 commit 9a5fff7

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

sample/app/app.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ angular.module('uiRouterSample', [
33
'uiRouterSample.contacts',
44
'uiRouterSample.contacts.service',
55
'uiRouterSample.utils.service',
6-
'ui.router',
6+
'ui.router',
7+
'ui.router.default',
78
'ngAnimate'
89
])
910

sample/app/contacts/contacts.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ angular.module('uiRouterSample.contacts', [
1111
//////////////
1212
.state('contacts', {
1313

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',
1717

1818
// This abstract state will prepend '/contacts' onto the urls of all its children.
1919
url: '/contacts',

sample/index.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.15/angular-animate.min.js"></script>
1515
<script src="//cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.14/angular-ui-router.min.js"></script>
1616

17+
<script src="../angular-ui-router-default.js"></script>
18+
1719
<!-- app.js declares the uiRouterSample module and adds items to $rootScope, and defines
1820
the "home" and "about" states
1921
-->
@@ -45,10 +47,9 @@
4547
<a class="brand" ui-sref="home">ui-router</a>
4648
<ul class="nav">
4749

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>
5253
<li ui-sref-active="active"><a ui-sref="about">About</a></li>
5354
</ul>
5455

0 commit comments

Comments
 (0)