Skip to content Skip to sidebar Skip to footer

How To Change The Url In The Browser Address Bar When Content Is Loaded In Ajax With Angular.js

I am designing a web app with angular.js, the communication within the application is through AJAX, that means when the apps requests a web resources, the url browser address never

Solution 1:

A good way to do this is using url pushstate.

It's too complex to write up a complete working demo, so you may want to google it.

Here's a nice article: http://www.sitepoint.com/javascript-history-pushstate/

Update:

pushstate will change the url in the browser, so the user can bookmark the page.

You also need to listen for popstate:

window.addEventListener("popstate", function(e) {  console.log(arguments) })

so you can react when the user push back/forward buttons.

Solution 2:

Well I tried to use google and i find this AngularJS Paging with $location.path but no ngView reload

Post a Comment for "How To Change The Url In The Browser Address Bar When Content Is Loaded In Ajax With Angular.js"