Angularjs 错误遇到的小坑

Error: ng:areq

Bad Argument

Argument 'fn' is not%20a%20function%2C%20got%20undefined

Description

AngularJS often asserts that certain values will be present and truthy using a helper function. If the assertion fails, this error is thrown. To fix this problem, make sure that the value the assertion expects is defined and truthy.

 

$scope.queryByIdOrMesg=function (){
                    // var userWantResJosn=angular.toJson($scope.userWantRes,true);
                    console.log(userWantResJosn);
                    $http.post(settings.apiProxy + 'api/cboard/voip/getFlowLogs',
                        {message:$scope.userWantRes}).success(function (response,status,config,headers){
                        $scope.logs = response;
                        console.log("status:"+status+"  config:"+config+"  headers:"+headers);
                    }).error(function (err) {
                        console.log(err);
                    })

我在做post请求时,报ng:areq错误,经过不断地改body,才发现自己少传了一个参数

var flowId = $stateParams.flowId;

即post的body里无页面跳转后传递过来的flowId,使得请求失败,改的话就是将flowId:flowId加入到post body里

你可能感兴趣的:(Angularjs 错误遇到的小坑)