Multiple du-scrollspy directives not working
It looks like you cannot have multiple du-scroll spy directives active at the same time.
Image a TOC as follows. Only the first instance of ng-repeat will work with scrollspy - the other 2 will do nothing.
<div ng-init="sections = [1,2,3,4]"></div>
<div ng-repeat="section in sections" du-scrollspy="{{section}}">{{section}}</div>
<div ng-repeat="section in sections" du-scrollspy="{{section}}">{{section}}</div>
<div ng-repeat="section in sections" du-scrollspy="{{section}}">{{section}}</div>
This also caused problem on my project... having to abandon this library because of this issue.
Did you guys tried to add an offset?
Works fine for me. You may need a {{du-spy-context}} though:
<ul du-spy-context
du-scroll-container="questionnaireList">
<li ng-repeat="section in sections">
<div du-scrollspy="{{section}}"></div>
</li>
</ul>
Perhaps one other difference, I'm not passing the target ID to scrollspy, but to smooth-scroll:
<div du-scrollspy
du-smooth-scroll="{{section}}">
</div>
You also only have one instance AFAICS. You will notice mine has 3 ng-repeats. It works with one, just not more than one.
In fact I have multiple ng-repeats because they are repeated themselves.
Even more: I have nested ng-repeats that each have scrollspys.
I didn't want to throw the whole block of code at you, but since it might help, here it is (I'll try and cut the irrelevant parts):
<ul du-spy-context
du-scroll-container="questionnaireList">
<li>
<a href="#{{::$ctrl.target}}"
du-scrollspy
du-smooth-scroll></a>
</li>
<li ng-repeat="group in $ctrl.data.groups">
<a href="#{{::$ctrl.group.target}}"
du-scrollspy
du-smooth-scroll></a>
<ul du-spy-context="questionnaire"
du-scroll-container="questionnaireList">
<li ng-repeat="product in ::$ctrl.group.questionnaires">
<div du-scrollspy
du-smooth-scroll="questionnaire_{{::$ctrl.product.id}}">
</div>
</li>
</ul>
</li>
<li>
<a href="#assessmentCheckout"
du-scrollspy
du-smooth-scroll></a>
</li>
</ul>
If you wonder about du-spy-context="questionnaire" that's some custom functionality that I added in a fork for a specific use case, but it will work without it.
I seem to be having the same issue. Is there any workaround?