$我的AngularJS項目中的http無法識別iOS上的40X(401,403,405 ...)錯誤。 我使用1.2.10 AngularJS版本和Cordova 3.4.0版本。
下面是我使用的代碼:
TE_SERVICES.factory('hello',function ($http,$rootScope) {
return {
loginUser: function(userCredentials,successCallback,errorCallback){
$http({
method: "GET",
url: "data/example.json",
headers: {"Authorization":'Basic '+userCredentials},
}).then(function(response){
successCallback(response.data);
console.log("Success------"+JSON.stringify(response))
},function(data, status, headers, config){
errorCallback(data);
console.log("Error------"+JSON.stringify(data)+" "+status)
})
}
}
});
hello.loginUser($rootScope.encodedUserCredencials,function(persons) {
// success handler
}, function(data) {
// error handler
console.log(data.status+"===="+status)
});
data.status
將返回0和狀態返回undefined。 請幫我解決這個問題。
試過包括IOS.But在白名單中域無解:(它仍然給出了同樣的答覆。
但相同的代碼工作絕對沒問題的Android系統。 請幫我解決這個問題。
在此先感謝:)
我有同樣的問題。你找到了解決方案嗎? –