我想从这个网站 https://bitcoinindex.es/api/v0.1/coinbase/usd/btc/lastCORS不适用于Angular?
GET信息使用$ http服务
寻找所有在互联网上以后这里是我的CoffeeScript代码
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
结果是
"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."
我不确定网站是否阻止了我(哪个wou没有道理,因为它是一个API),或者如果AngularJS不能使用CORS。
这是一个公共API,虽然文档在这里https:// bitcoinindex。es/api – grasshopper 2014-09-26 20:39:03