angular-scrollspy icon indicating copy to clipboard operation
angular-scrollspy copied to clipboard

Update href when in view

Open mebibou opened this issue 6 years ago • 2 comments

The elements do get the active class when they are in view, but the href of the url is not updated. Would it be possible to add this as an option?

mebibou avatar Sep 20 '18 15:09 mebibou

@mebibou thanks for feedback, that would be a nice feature. Will try to take a look at it when I get a chance.

edoparearyee avatar Oct 02 '18 09:10 edoparearyee

FYI to activate this behaviour I am currently using

<sn-scroll-spy-section for="scrollNav" id="a" snInViewport inViewportChange)="inViewport($event, 'a')"></sn-scroll-spy-section>
<sn-scroll-spy-section for="scrollNav" id="b" snInViewport inViewportChange)="inViewport($event, 'b')"></sn-scroll-spy-section>
class Component {
  constructor(private location: Location) {}
  inViewport(inViewport, id) {
    if (inViewport) {
      this.location.go(`#${id}`);
    }
  }
}

I also configured my RouterModule to useHash: false, not sure if it would work otherwise

mebibou avatar Nov 27 '18 15:11 mebibou