【问题标题】:AngularJS ngResource without call back exception Error: noop is not a functionAngularJS ngResource 没有回调异常错误:noop 不是函数
【发布时间】:2015-06-08 00:16:51
【问题描述】:
$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 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

【问题讨论】:

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


    【解决方案1】:
    $scope.validate = function () {
            $scope.model.$validate({ value: $scope.model }, $.noop, function (response) {
                $scope.modelState = response.data.ModelState;
            });
        }
    

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-11-27
      • 1970-01-01
      • 2016-04-04
      • 2018-09-03
      • 1970-01-01
      • 2013-05-10
      • 2020-05-09
      相关资源
      最近更新 更多