Skip to content

Commit f05f3e3

Browse files
Merge pull request #100 from angular/master
Update upstream
2 parents badcbf1 + a90d0cb commit f05f3e3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

docs/app/src/directives.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,16 @@ directivesModule
9191
.component('tocTree', {
9292
template: '<ul>' +
9393
'<li ng-repeat="item in $ctrl.items">' +
94-
'<a ng-href="#{{item.fragment}}">{{item.title}}</a>' +
94+
'<a ng-href="{{ $ctrl.path }}#{{item.fragment}}">{{item.title}}</a>' +
9595
'<toc-tree ng-if="::item.children.length > 0" items="item.children"></toc-tree>' +
9696
'</li>' +
9797
'</ul>',
9898
bindings: {
9999
items: '<'
100-
}
100+
},
101+
controller: ['$location', /** @this */ function($location) {
102+
this.path = $location.path().replace(/^\/?(.+?)(\/index)?\/?$/, '$1');
103+
}]
101104
})
102105
.directive('tocContainer', function() {
103106
return {

0 commit comments

Comments
 (0)