Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
angularjs日期问题:未定义_Angularjs_Ionic Framework - Fatal编程技术网

angularjs日期问题:未定义

angularjs日期问题:未定义,angularjs,ionic-framework,Angularjs,Ionic Framework,我的申请在某个日期有问题 我有一个用symfony制作的API,还有一个用Angularjs在爱奥尼亚下开发的客户端。 我使用Postman进行测试,一切正常,但当我尝试设置该功能时,出现了一个错误 我的日期是“未定义” 当我尝试使用API与应用程序通信时 这是我的密码: 我的服务: var userDispo = function(id,date){ var id = window.localStorage.getItem('antenne'); return $http({

我的申请在某个日期有问题

我有一个用symfony制作的API,还有一个用Angularjs在爱奥尼亚下开发的客户端。 我使用Postman进行测试,一切正常,但当我尝试设置该功能时,出现了一个错误

我的日期是
“未定义”

当我尝试使用API与应用程序通信时

这是我的密码:

我的服务:

var userDispo = function(id,date){
    var id = window.localStorage.getItem('antenne');
    return $http({
           method  : 'GET',
           url     : API_ENDPOINT.url + '/user/dispo/' + id + '/' + date,
           headers : {Authorization : 'Bearer ' + $http.defaults.headers.common.Authorization}
       }).then(function(result) {
       return result.data;
    });
};
我的控制器:

.controller('UserDispoCtrl',
function ($scope, $stateParams, $ionicLoading, AppService) {
$ionicLoading.show();
$scope.date = new Date().toISOString().slice(0, 10);
console.log($scope.date);
AppService.userDispo($scope.date).then(function (response){
    console.log(response);        
});
})

在我的控制器中,第一个
“console.log($scope.date)”
很好地显示了“2018-04-25”

在我出现以下错误之后:

得到 404(未找到)

我不明白错误来自何处,我的URL应该如下所示:

有人会有一个轨道或解决方案建议,请


提前谢谢

是的,它将在调用函数时被取消定义 userDispo它有两个参数id和日期,第一个参数是id,第二个参数是日期

因为在调用userDispo时,您需要传递

AppService.userDispo($scope.id,$scope.date)
并全局定义要访问的id

 $scope.id = window.localStorage.getItem('antenne');

在你的服务函数中,你有(id,date),当你调用它时,你只传递第一个参数so AppService.userDispo($scope.date),所以你传递的是id而不是日期。我的id已经存在于url中,它是'19',唯一没有显示的是我的日期检查参数orderOh是的,这是真的!!我的坏朋友:非常感谢