AngularJS $httpBackend - “No more request expected” error

前端 未结 2 898
死守一世寂寞
死守一世寂寞 2020-12-31 07:15

It seems this is working solution that shows how to work with $httpBacked http://jsfiddle.net/EgMpe/8/

But for my case:

routes<

相关标签:
2条回答
  • 2020-12-31 07:23

    Using $httpBackend you have to specify in advance all request you are going to perform. Maybe this short excerpt from Mastering Web Application Development with AngularJS will clarify why:

    The verifyNoOutstandingExpectation method verifies that all the expected calls were made ($http methods invoked and responses flushed), while the verifyNoOutstandingRequest call makes sure that code under test didn't trigger any unexpected XHR calls. Using those two methods we can make sure that the code under the test invokes all the expected methods and only the expected ones.

    0 讨论(0)
  • 2020-12-31 07:26

    Ah.. Sorry I just was wrong with my RegEx:

    if type this $httpBackend.whenGET(/partials/).passThrough();

    Then all start working.

    So, I got my lesson: don't forget to put: passThrough(); with right RegEx.

    0 讨论(0)
提交回复
热议问题