AngularJS和财务报价问题

时间:2014-08-16 05:57:44

标签: angularjs yahoo-finance

我的Angular请求出了问题。

angular.module('google-chart-example', []).controller("MainCtrl", function ($scope,$http,$log) {

    $scope.infos = "";

    //$http.get('http://ip.jsontest.com')
    //$http.get('https://finance.google.com/finance/info?q=TSE:PXT')
    $http.get('http://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.quotes where symbol in ("AAPL")&format=json')
    .success(function(data) {
            //alert ("toto");
            $scope.infos = data;

    })
    .error(function(data) {
            alert ("data="+data);
        $scope.infos = data;
    });


});

$ http.get(' http://ip.jsontest.com') ==>这是一个工作正常..没问题

$ http.get(' https://finance.google.com/finance/info?q=TSE:PXT') ==>这个没有用,我没有结果

$ http.get(' http://query.yahooapis.com/v1/public/yql?q=select *来自yahoo.finance.quotes,其中符号位于(" AAPL")& format = json') ==>这一个,我得到了答案,但它告诉我表格不存在: {"错误":{" lang":" zh-CN","说明":"没有找到表雅虎的定义.finance.quote"}} (我试过引用和引用:同样的结果)

我知道为什么我无法取回价格?

我的HTML:

<html xmlns="http://www.w3.org/1999/html">
<head>

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.18/angular.js"</script>
<script src="index3.js"></script>
 </head>
<body ng-app="google-chart-example" ng-controller="MainCtrl">
coucou <br>
{{infos}}
</body>
</html>

3 个答案:

答案 0 :(得分:1)

你试图查询yahoo.finance.quotes,但查询需要在yahoo.finance.quote上

select * from yahoo.finance.quote

答案 1 :(得分:0)

答案 2 :(得分:0)

对于Yahoo我缺少社区表参数: &安培; ENV =商店%3A%2F%2Fdatatables.org%2Falltableswithkeys

它现在有效,谢谢。