UI-router interfers with $httpbackend unit test, angular js

后端 未结 5 598
悲&欢浪女
悲&欢浪女 2020-11-29 01:59

This is a controller with a submit function:

$scope.submit = function(){   

 $http.post(\'/api/project\', $scope.project)
      .success(function(data, stat         


        
5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-29 02:22

    If you don't want to add gist files like it says in the correct solution you can add a "when" condition to your $httpBackend to ignore GET petitions of views like this:

    $httpBackend.when("GET", function (url) {
        // This condition works for my needs, but maybe you need to improve it
        return url.indexOf(".tpl.html") !== -1;
    }).passThrough();
    

提交回复
热议问题