Im having a problem in getting the json result on one of my api's:
Tried calling it using the code below:
var url = 'domain.com/'
var query = $http({
method: 'GET',
url: url,
headers: {'Content-Type': 'application/json'}
});
console.log(query);
and a simple $http get on my controller
var url = $http.get('http://domain.com');
console.log(url);
Always gave me the
XMLHttpRequest cannot load http://domain.com. Origin domain is not allowed by Access-Control-Allow-Origin.
Then I tried changing the method type from GET to JSONP but gave me a
Uncaught SyntaxError: Unexpected token :
Weird coz if you view the url using a web browser it is a valid json object.