没有回调异常的AngularJS ngResource错误:noop不是函数

时间:2015-04-02 21:56:58

标签: angularjs asp.net-web-api ngresource

$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控制器的资源我收到以下异常:

错误:noop不是函数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 / this。$ gethttp:// localhost:55470 / Scripts / angular.js:14217:15 $ RootScopeProvider / this。$ gethttp:// localhost:55470 / Scripts / angular.js:14506:13完成@ 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

1 个答案:

答案 0 :(得分:0)

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

看起来好像无法将新对象传递给成功处理程序..