Redirect using AngularJS

后端 未结 6 1332
情书的邮戳
情书的邮戳 2020-11-30 02:28

I\'m trying to redirect to another route using:

$location.path(\"/route\");

But for some reason it is not working. I did an auto-complete w

6条回答
  •  再見小時候
    2020-11-30 02:44

    With an example of the not-working code, it will be easy to answer this question, but with this information the best that I can think is that you are calling the $location.path outside of the AngularJS digest.

    Try doing this on the directive scope.$apply(function() { $location.path("/route"); });

提交回复
热议问题