代码:
当我浏览浏览器中的url时,我可以看到所有对象,例如: link
但我似乎没有让它在我的代码中工作,我错过了什么?
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;
});
});
答案 0 :(得分:1)
添加" 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');
});