I am working on angularjs application. When trying to hit the https url ,i am getting the below exception.
XMLHttpRequest cannot load https://xyz.abc.com. No 'Access-Control-Allow-Origin' header is present on the requested resource.
js code:
controller:
app.controller("myController",["$scope",'MyService',function($scope,MyService){
MyService.getResposneData().error(function(error){
console.log("Error");
}).
then(function(response){
$scope.req=response;
console.log(angular.toJson(response));
});
}]);
service:
instanceService.getResposneData = function() {
var prom=$http({
method: 'GET',
url:"https://xyz.abc.com"}).
success(function(response){
alert("success " + response);
return response;
}).
error(function(err){
alert("error " + err);
return err;
});
return prom;
}
Before resolving the exception i got , i want to know how can i pass username and password details in my service call (getResposneData).Any inputs?