javascript - Replace history and then redirect in AngularJS - Stack Overflow

While trying to access window.location or window.history directly, how can I do the following in Angula

While trying to access window.location or window.history directly, how can I do the following in AngularJS:

  1. Replace the history for current location
  2. Redirect to a new location

For example:

  • user goes to "/#/loc1"
  • I want the history to show they went to "/#/loc2"
  • Then redirect to "/#/loc3"
  • If they use the browser.back, it should return them to "#/loc2"

While trying to access window.location or window.history directly, how can I do the following in AngularJS:

  1. Replace the history for current location
  2. Redirect to a new location

For example:

  • user goes to "/#/loc1"
  • I want the history to show they went to "/#/loc2"
  • Then redirect to "/#/loc3"
  • If they use the browser.back, it should return them to "#/loc2"
Share Improve this question asked Oct 5, 2013 at 3:00 wag2639wag2639 2,5835 gold badges25 silver badges30 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 11

Is this what you want?

$location.path('/blahblah').replace();

See API Docs for $location

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1743729968a4497264.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信