代码:
当我通过浏览器中的url时,当我尝试使用它时,我可以看到所有的对象,例如:链接
但我似乎没能让它在我的代码中起作用--我遗漏了什么吗?
angular.module('ionicApp', ['ionic'])
.controller('MyCtrl', function($scope, $http) {
$scope.items = [];
$http.jsonp('cmaden.pythonanywhere.com/api/v1/today/?format=jsonp').success(function (data) {
$scope.items = data;
});
});发布于 2014-09-08 12:47:29
在网址的前面加上"https://“”。您还需要回调。请参阅下面的例子。
angular.module('ionicApp', ['ionic'])
.controller('MyCtrl', function($scope, $http) {
window.callback = function(data) {
$scope.items = data
}
$scope.items = [];
$http.jsonp('https://cmaden.pythonanywhere.com/api/v1/today/?format=jsonp');
});https://stackoverflow.com/questions/25723196
复制相似问题