2015-04-02 60 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; 
     }); 
    } 

看起來就好像你不能將一個新的對象,以成功處理..

相關問題