Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

dynamic ids in pageitems #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion dist/ngScrollSpy.debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,14 @@ mod.directive('pageitems', function(ScrollSpy) {
return;
}
scope.spyElems = elem[0].getElementsByClassName(scope.selector); // dom items

// Prefix the page URL base URL to the id
if (angular.isDefined(scope.pageurl)) {
for (var i = 0; i < scope.spyElems.length; i++) {
scope.spyElems[i].id = scope.pageurl + '#' + scope.spyElems[i].id;
}
}

scope.spies = {}; // menu items

// this function will be called once dom is parsed and menu is created
Expand Down Expand Up @@ -425,7 +433,8 @@ mod.directive('pageitems', function(ScrollSpy) {
restrict: 'A',
scope: {
selector: '@',
topmargin: '@'
topmargin: '@',
pageurl: '@'
},
link: linkfn
};
Expand Down
11 changes: 10 additions & 1 deletion dist/ngScrollSpy.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,14 @@ mod.directive('pageitems', function(ScrollSpy) {
return;
}
scope.spyElems = elem[0].getElementsByClassName(scope.selector); // dom items

// Prefix the page URL base URL to the id
if (angular.isDefined(scope.pageurl)) {
for (var i = 0; i < scope.spyElems.length; i++) {
scope.spyElems[i].id = scope.pageurl + '#' + scope.spyElems[i].id;
}
}

scope.spies = {}; // menu items

// this function will be called once dom is parsed and menu is created
Expand Down Expand Up @@ -425,7 +433,8 @@ mod.directive('pageitems', function(ScrollSpy) {
restrict: 'A',
scope: {
selector: '@',
topmargin: '@'
topmargin: '@',
pageurl: '@'
},
link: linkfn
};
Expand Down
2 changes: 1 addition & 1 deletion dist/ngScrollSpy.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion src/pageitems.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ mod.directive('pageitems', function(ScrollSpy) {
return;
}
scope.spyElems = elem[0].getElementsByClassName(scope.selector); // dom items

// Prefix the page URL base URL to the id
if (angular.isDefined(scope.pageurl)) {
for (var i = 0; i < scope.spyElems.length; i++) {
scope.spyElems[i].id = scope.pageurl + '#' + scope.spyElems[i].id;
}
}

scope.spies = {}; // menu items

// this function will be called once dom is parsed and menu is created
Expand Down Expand Up @@ -77,7 +85,8 @@ mod.directive('pageitems', function(ScrollSpy) {
restrict: 'A',
scope: {
selector: '@',
topmargin: '@'
topmargin: '@',
pageurl: '@'
},
link: linkfn
};
Expand Down