Angularjs how to cancel resource promise when switching routes

后端 未结 5 1880
孤街浪徒
孤街浪徒 2020-11-30 05:00

I\'m just getting my feet wet with Angularjs. I have an issue which I think has something to do with promises.

Let\'s say I load route \'A\' which makes several ajax

5条回答
  •  南方客
    南方客 (楼主)
    2020-11-30 05:14

    Take a look at this post

    You could do what he is doing and resolve the promise to abort the request on a route change (or state change if using ui router).

    It may not be the easiest thing to make happen but seems like it can work.

提交回复
热议问题