I'm pretty new to AngularJS, but for some reason i have to use it and create small web-page, to be able to sent some requests to my Web Api 2 part. I`m stuck with one strange error. My Controller is in ApplicationFrontEnd/MainView folder, file is called "main.js". Problem part of code :
var request = {
method: 'POST',
url: 'api/login',
headers: {
'Authorization': 'Basic ' + encoded
}
}
$http(request)
.success(function (data, status, headers, config) {
// I`m supposed to have no problem
})
.error(function (data, status, headers, config) {
//but for some reason i do have.
});
So, at the point of sending post request is sent not to 'api/login' , but to 'ApplicationFrontEnd/api/login', and do not have any Authorization header.
On Web Api part of project i have CORS turned on, etc., but while i have wrong url in request, i receive 404 error (pretty logical). Can someone please explain to me, what i'm doing wrong and how to fix it?