Search code examples
javascripthtmlangularjsangularjs-directivelocation-href

Simple Return to Top Button Does Not Work with AngularJS


I am writing a web app using AngularJS on the frontend and I'm implementing a return to top button at the bottom of the page.

   <h1 id = "top">
    ..........
   <a href="#top">Return to Top</a>

However, this does not work at all. I'm lost because this has worked before on other apps that do not use Angular. So do I have to do something different here?


Solution

  • add target="_self" to href will solve the problem. Thanks to @Chandermani