Hi,
I’m trying to do an external post to an api. When i run it with ionic serve, it’s working fine, but when i’m running it on the emulator i’m getting an 404 error. Can somebody explain why it is working in ionic serve but not in de emulator?
$http.defaults.headers.common["Accept"] = "application/json";
$http.defaults.headers.common["Content-Type"] = "application/json";
$http.defaults.headers.common["Access-Control-Allow-Origin"] = "*";
login: function() {
var objPost = {
"grant_type": "password",
"client_id": "testclient",
"client_secret": "testclient1234",
"username": 'test',
"password": 'test1234'
};
// 'url' is de location of the api
$http.post('url', objPost)
.success(function (data, status, headers, config) {
localStorageService.set('authorisationData', data);
$rootScope.$broadcast('event:auth-loginConfirmed', status);
})
.error(function (data, status, headers, config) {
$rootScope.$broadcast('event:auth-login-failed', status, data, headers, config);
});
}