Monday, 16 May 2016

why Angularjs $anchorScroll and $location fails the first time and only work after second click

If you look your browser url, the url is changed after the first click and the webpage flickered.

That because after the url changed to xxxxx#anchor1, it re-rendered the web page.

To fix this we have to stop the re-render by putting this into your router: reloadOnSearch: false


    resolve: {
        reloadOnSearch: false

No comments:

Post a comment