Sharing Top Content from the Angular-sphere.

AngularJS Change Path Without Reloading

  • To change path URL with AngularJS, $location.path() is passed the new URL as a parameter, and the page is automatically reloaded.
  • This means that if you ever make a change to the URL in an Angular application, then the partial and controller will be reloaded automatically.
  • So rather than just taking in the new URL, it will also take in a boolean were true will refresh the page and false will not.
  • There you go, now here is what it will look like in the controller where the path is being changed.
  • Well, that’s all there is to it, we are now free to change path of the URL without reloading the page.

Change the current path with AngularJS without forcing the page’s content to reload.

@AlcidesRC: AngularJS Change Path Without Reloading – consolelog.io

is passed the new URL as a parameter, and the page is automatically reloaded. This means that if you ever make a change to the URL in an Angular application, then the partial and controller will be reloaded automatically. This is great most of the time, however, there are times when reloading the controller is unwanted. AngularJS doesn’t have a native fix to stop reloading when the path is changed. So a quick addition to our

file.

There you go, now here is what it will look like in the controller where the path is being changed.

Well, that’s all there is to it, we are now free to change path of the URL without reloading the page. If you have any questions, comments or suggestions feel free to leave a comment!

AngularJS Change Path Without Reloading