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

后端 未结 5 596
悲&欢浪女
悲&欢浪女 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条回答
  •  -上瘾入骨i
    2020-11-29 02:34

    Move your services to their own module that have no dependency on ui.router. have your main app depend on this module. When you test don’t test the main app, test the module that has your services in it. The stateprovider won’t try to change state/route because this module knows nothing about the ui.router. This worked for me.

提交回复
热议问题