2
私は角度コントローラと角度サービスを持っています。私のコントローラから、私はサービスに電話しています。私のサービスには2つの機能があります。最初の関数は正常に動作します。しかし、この問題は2番目の問題で発生します。次に、関連する関数のコードを示します。
コントローラからそのサービスの機能を呼び出すためのコードに続いてfunction getCurrentUser() {
return $resource(_URLS.BASE_API + 'get_current_user' + _URLS.TOKEN_API + $localStorage.token).get().$promise;
}
、
//Get current user id
$scope.getCurrentUserId = function() {
ParentService.getCurrentUser.then(function(response) {
if (response.query_status == "success") {
$scope.userid = response.data.id;
console.log('Value is: '+ $scope.userid);
} else {
$scope.userid = null;
}
}, function(error) {
$scope.userid = null;
console.log("Error : Failed to load user data...");
console.log(error);
});
};
私は私の最初の機能が正常に動作しますので、問題が何であるかを把握することはできません。だから誰かが私にこの問題を解決するのを助けることを願っています