我想要的只是构建一个简单的RSS应用程序。到目前为止,该应用程序在浏览器上工作正常,但是当我尝试将其构建到我的手机中时,整个rss部分都消失了。 我在离子 - 自耕农框架上使用角度。
我的服务:
'use strict';
angular.module('RedColor.services', [])
.factory('myService', function($http) {
return {
getFoo: function() {
// since $http.get returns a promise,
// and promise.then() also returns a promise
// that resolves to whatever value is returned in it's
// callback argument, we can return that.
return $http.jsonp('//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=50&callback=JSON_CALLBACK&q=http://www.ynet.co.il/Integration/StoryRss1854.xml');
}
}
});
我的控制器:
.controller('PlaylistsCtrl', function(myService,$scope) {
myService.getFoo().then(function(data) {
// this will execute when the
// AJAX call completes.
$scope.playlists = data.data.responseData.feed.entries;
console.log(data);
});
})
我的HTML:
<ion-content class="has-header">
<ion-list>
<h2 align="right">מבזקים</h2>
<ul align="right">
<li ng-repeat="playlist in playlists">{{playlist.title}}</li>
</ul>
<ion-item align="right" class="item-icon-right" ng-repeat="playlist in playlists track by $index" href="#/app/playlists/{{playlist.id}}">
{{playlist.title}}
</ion-item>
</ion-list>
</ion-content>
答案 0 :(得分:4)
尝试在Google API之前添加http:
返回$ http.jsonp('http://ajax.googleapis.com/ajax/services/feed/load ...');