$locationChangeSuccess doesn't wait for route resolve

Angular 1.4.10

In my application I use $routeProvider with asynchronous resolution.

I have a form with a submit button that, when form is submitted and request is success we do a redirection .

The redirection could affect the route, or only the $location.search(). I would like to listen for both changes, to show a message once all is finished (request, redirection and/or async resolution of the route).

If I use $routeChangeSuccess , it's only fired if path changes, and it waits to the resolution in the routeProvider, but it's not fired if only $location.search() changes.

If I use $locationChangeSuccess , it's fired if path or search changes, the problem is that , it doesn't wait for routeProvider async resolution .

The only solution I find for now is, to process the newUrl and oldUrl,if the path will be changed, listen for $routeChangeSuccess, otherwise listen for $locationChangeSuccess, or nothing if the oldUrl is the same than newUrl.

I would like to avoid this extra processing. Any idea?

链接地址: http://www.djcxy.com/p/77950.html

上一篇: angular ui router:component $ onInit在路由更改时触发两次

下一篇: $ locationChangeSuccess不等待路由解析