.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;
}]);
答案 0 :(得分:0)
你错过了在函数中注入$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;
}
]);