简体   繁体   中英

Angular $locationProvider.html5Mode with $window variables

I recently run into problems with google indexing because of angular routing. So, the solution that I found was using $locationProvider.html5Mode.

But now I created another problem, the $window variables loose their value when the user navigates between the same page application routes.

There is any way that I can keep the value of an $window variable between controllers using $locationProvider.html5Mode set to true? (In the same page app).

I was doing:

window.location.href = "/base/some_route/";

turns out I should be doing:

$location.path("/someroute");

Hope that this will save time to someone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM