【问题标题】:jsonData will not Print on console there is no erros it just will not printjson数据不会在控制台上打印没有错误它只是不会打印
【发布时间】:2016-11-23 03:06:53
【问题描述】:
.controller('StocksCtrl',['$scope','$stateParams','$http',
  function($scope, $stateParams) {

    //http://finance.yahoo.com/webservice/v1/symbols/YHOO/quote?bypass=true&format=json&view=detail
    $http.get("http://finance.yahoo.com/webservice/v1/symbols/YHOO/quote?bypass=true&format=json&view=detail")
      .then(function(jsonData) {
        console.log(jsonData);
      });



  $scope.ticker = $stateParams.stockTicker;
}]);

【问题讨论】:

  • 我的回答对你有帮助吗??如果不尝试在plunker 上复制问题,这将有助于我们调试。
  • 或者他缺少控制台插件?

标签: javascript angularjs json cordova ionic-framework


【解决方案1】:

你错过了在函数中注入$http

.controller('StocksCtrl', ['$scope', '$stateParams', '$http',
    function($scope, $stateParams,$http) {

        //http://finance.yahoo.com/webservice/v1/symbols/YHOO/quote?bypass=true&format=json&view=detail
        $http.get("http://finance.yahoo.com/webservice/v1/symbols/YHOO/quote?bypass=true&format=json&view=detail")
            .then(function(jsonData) {
                console.log(jsonData);
            });

        $scope.ticker = $stateParams.stockTicker;
    }
]);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-29
    • 1970-01-01
    • 2016-10-31
    • 2012-10-13
    相关资源
    最近更新 更多