2014-10-31 38 views
0

我正在嘗試使用this great sample爲安卓創建一個RSS閱讀器應用程序Cordova科爾多瓦RSS閱讀器應用程序無法正常工作

我遵循了所有的說明,並在模擬器上模擬我的應用程序。但它只是給我:

Simple RSS Reader 

{{ entry.title }} 

下面是index.html

<!DOCTYPE html> 
<html> 
<head> 
    <meta charset="utf-8"> 
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> 
    <title></title> 
    <link href="lib/ionic/css/ionic.css" rel="stylesheet"> 
    <link href="css/style.css" rel="stylesheet"> 
    <script src="lib/ionic/js/ionic.bundle.js"></script> 
    <script src="cordova.js"></script> 
    <script src="js/app.js"></script> 
</head> 
<body ng-app="starter"> 
<ion-pane> 
    <ion-header-bar class="bar-stable"> 
     <h1 class="title">Simple RSS Reader</h1> 
    </ion-header-bar> 
    <ion-content ng-controller="FeedController" ng-init="init()"> 
     <div class="list"> 
      <a ng-repeat="entry in entries" class="item" ng-click="browse(entry.link)"> 
       <b>{{ entry.title }}</b><br> 
       <span ng-bind-html="entry.contentSnippet"></span> 
      </a> 
     </div> 
    </ion-content> 
</ion-pane> 
</body> 
</html> 

的代碼,這是我的app.js內容

angular.module('starter', ['ionic', 'starter.controllers', 'starter.services']); 

rssApp.controller("FeedController", function($http, $scope) { 

    $scope.init = function() { 
     $http.get("http://ajax.googleapis.com/ajax/services/feed/load", 
      { params: { "v": "1.0", "q": "http://blog.nraboy.com/feed/" } }) 
      .success(function(data) { 
       $scope.rssTitle = data.responseData.feed.title; 
       $scope.rssUrl = data.responseData.feed.feedUrl; 
       $scope.rssSiteUrl = data.responseData.feed.link; 
       $scope.entries = data.responseData.feed.entries; 
       window.localStorage["entries"] = JSON.stringify(data.responseData.feed.entries); 
      }) 
      .error(function(data) { 
       console.log("ERROR: " + data); 
       if(window.localStorage["entries"] !== undefined) { 
        $scope.entries = JSON.parse(window.localStorage["entries"]); 
       } 
      }); 
    }; 
    $scope.browse = function(v) { 
     window.open(v, "_system", "location=yes"); 
    } 
}); 

哪位知道如何解決這一問題?

+0

你確定你的離子文件引用是正確的,我的意思是路徑是引用到你的index.html的正確路徑,看起來像角沒有被踢入和處理{{和}} – mentat 2014-11-01 11:41:29

回答

0

好的。在博主@ nic-raboy的幫助下,我設法解決了這個問題。問題是在模塊行:

angular.module('starter', ['ionic', 'starter.controllers', 'starter.services']); 

'starter.controllers''starter.services'是屬於離子樣品,我不得不從線中刪除。所以我這樣解決:

angular.module('starter', ['ionic']) 
    .controller("FeedController", function($http, $scope) { 

現在它工作正常。

相關問題