I am attempting to retrieve data from a site with the URL:
Using the $http service
After extensive research, I have come up with this CoffeeScript code snippet:
angular.module('blackmoonApp')
.controller 'PricingCtrl', ($scope, $http) ->
$http.defaults.useXDomain = true
$http.get("https://bitcoinindex.es/api/v0.1/coinbase/usd/btc/last",
headers:
"Access-Control-Allow-Origin": "*"
).success (JSON) ->
console.log JSON
The outcome is as follows:
"XMLHttpRequest cannot load https://www.bitstamp.net/api/ticker/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:9000' is therefore not allowed access."
I am uncertain if the website is intentionally blocking me (which seems unlikely given that it's an API), or if there are limitations with AngularJS when dealing with CORS.