TypeError:successFunction不是函数 - angular.js:13529

时间:2016-04-18 22:05:18

标签: javascript jquery angularjs

bookController.js

从网址获取两个参数1)clientid 2)bookId

$scope.clientId = $location.search().clientId;
$scope.bookId = $location.search().bookId;
bookService.getSingleBook($scope.clientId, $scope.bookId,$scope.getResponse, $scope.ErrorResponse);

bookService.js

 this.getSingleBook = function (clientId, bookId, successFunction, errorFunction) {
        ajaxService.AjaxGet("http://localhost/samplewebsite/api/Book?clientId=" + clientId + "&bookId=" + bookId, successFunction, errorFunction);
    };

ajaxService.js

 this.AjaxGet = function (route, successFunction, errorFunction) {
        blockUI.start();
        setTimeout(function () {
            $http({ method: 'GET', url: route }).success(function (response, status, headers, config) {
                blockUI.stop();
                successFunction(response);//getting type error
            }).error(function (response) {
                blockUI.stop();
                errorFunction(response);
            });
        }, 1000);

    };

successFunction(响应)是将数据作为响应获取,但是当它返回响应时它通过错误 TypeError:successFunction不是函数 - angular.js:13529 < / p>

enter image description here

0 个答案:

没有答案