2015-12-08 93 views
-1

我試圖讓一個應用程序顯示我的博客文章在新聞feed.I使用離子爲它。我的問題是,帖子的標題不顯示在html頁面,而我可以訪問他們在控制檯窗口中。我無法理解這個原因。請幫我解決這個問題。 我的HTML頁面的代碼是內容不顯示在Ionic

<ion-view view-title="TheGeekInn" ng-controller="homeCtrl"> 
    <ion-content> 
    <h1>Geek</h1> 
    <div ng-repeat="story in stories"> 
     {{story.title}} 
    </div> 
    </ion-content> 
</ion-view> 

和控制器代碼

.controller('homeCtrl',function($http,$scope){ 
    $scope.stories=[]; 
    $http.get('http://www.thegeekinn.in/category/technical/?json=1').success(function(response){ 
    angular.forEach(response.posts,function(post){ 
    $scope.stories.push(post.title); 
    console.log(post.title); 
      }); 
    }); 
}) 

回答

1

我想這和它的工作。不幸的是我不知道爲什麼。希望這可以幫助。

$http.get('http://www.thegeekinn.in/category/technical/?json=1').success(function(response){ 
      $scope.stories=response.posts; 
     }); 
+0

感謝它的工作:) – user317461