Is there a way to effectively utilize AngularStrap's ScrollSpy feature to link to anchors within the same document?
Upon reviewing the AngularStrap documentation, I noticed that when a link is clicked, a double hash is generated in the URL. For example:
However, when trying to implement this functionality myself, I am not experiencing the same behavior. In my case, the anchor tags are attempting to update the location rather than moving to a specific section within the current document.
The AngularStrap ScrollSpy feature is located on a sub-page: my-site.com/#/hig
. Here is how it is defined:
<div class="hig-sidebar hidden-print hidden-sm hidden-xs" role="complementary" data-offset-top="-34" bs-affix bs-scrollspy-list>
<ul class="nav hig-sidenav">
<li bs-scrollspy data-target="#overview">
<a href="#overview">Overview</a>
<ul class="nav">
<li bs-scrollspy data-target="#suboverview"><a href="#suboverview">Subsection</a></li>
</ul>
</li>
<li bs-scrollspy data-target="#accessibility"><a href="#accessibility">Accessibility</a></li>
<!-- More list items here -->
</ul>
<a href ng-click="gotoTop()">Back to top</a>
</div>
While scrolling through the document, the ScrollSpy correctly highlights the current section. However, when clicking on a link like "Color and Typography", the URL is updated to: my-site.com/#typography
.
I have examined the AngularStrap code but cannot figure out why the anchor links are replacing #/hig
instead of appending to it. How can I ensure that the anchor link adds to the existing URL path?