2015-04-02 58 views
0
$scope.validate = function() { 
     $scope.model.$validate({ value: $scope.model }, {}, function(response) { 
      $scope.modelState = response.data.ModelState; 
     }); 
    } 

return $resource(baseUrl, null, { 'validate': { method: 'PUT', params: { id: 0 } } }).get({ id: Id }); 

调用消耗的web API控制器我收到以下异常的资源:AngularJS ngResource没有回电异常错误:空操作,是不是一个函数

错误:空操作,是不是一个函数resourceFactory/HTTP:/ /localhost:55470/Scripts/angular-resource.js:626:18 processQueue @http://localhost:55470/Scripts/angular.js:13189:27 scheduleProcessQueue/< @http://localhost:55470/Scripts/angular.js:13205:27 $ RootScopeProvider/this。$ gethttp:// localhost:55470/Scripts/angular.js:14401:16 $ RootScopeProvider/$ gethttp:// localhost:55470/Scripts/angular.js:14217:15 $ RootScopeProvider/this。$ gethttp:// localhost:55470/Scripts/angular.js:14506:13 done @http://localhost:55470/Scripts/angular.js:9659:36 completeRequest @http://localhost:55470/Scripts/angular.js:9849:7 requestLoaded @http://localhost:55470/Scripts/angular.js:9790:1

回答

0
$scope.validate = function() { 
     $scope.model.$validate({ value: $scope.model }, $.noop, function (response) { 
      $scope.modelState = response.data.ModelState; 
     }); 
    } 

看起来就好像你不能将一个新的对象,以成功处理..

相关问题