We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents badcbf1 + a90d0cb commit f05f3e3Copy full SHA for f05f3e3
docs/app/src/directives.js
@@ -91,13 +91,16 @@ directivesModule
91
.component('tocTree', {
92
template: '<ul>' +
93
'<li ng-repeat="item in $ctrl.items">' +
94
- '<a ng-href="#{{item.fragment}}">{{item.title}}</a>' +
+ '<a ng-href="{{ $ctrl.path }}#{{item.fragment}}">{{item.title}}</a>' +
95
'<toc-tree ng-if="::item.children.length > 0" items="item.children"></toc-tree>' +
96
'</li>' +
97
'</ul>',
98
bindings: {
99
items: '<'
100
- }
+ },
101
+ controller: ['$location', /** @this */ function($location) {
102
+ this.path = $location.path().replace(/^\/?(.+?)(\/index)?\/?$/, '$1');
103
+ }]
104
})
105
.directive('tocContainer', function() {
106
return {
0 commit comments