数据显示在日志中,但现在显示在我的页面中。我想加载数据。有什么问题?
function AppController($scope, TestFactory) {
/* console.log("AppController is now available.");*/
$scope.testdata= [];
TestFactory.getData().then(function(response) {
$scope.testdata = response.data;
console.log("Data:", $scope.testdata);
})
}
<ion-slide-page ng-repeat="event in testdata">
<div class="now-viewport">
<div class="event-image">
</div>
<div class="event-placeholder">
<div class="event-title">{{ event.message}}</div>
<div class="event-details">
</div>
</div>
</div>
</ion-slide-page>
答案 0 :(得分:1)
尝试下面的代码
<ion-slide-page ng-repeat="event in testdata.message">
<div class="now-viewport">
<div class="event-image">
<div class="event-placeholder">
<div class="event-title">{{event}}</div>
<div class="event-details"></div>
</div>
</div>
</div>
</ion-slide-page>
答案 1 :(得分:0)
您的回复是 object
,其中 message
是字符串的数组,请尝试以下操作,< / p>
<ion-slide-page ng-repeat="event in testdata.message">
<div class="now-viewport">
<div class="event-image">
<div class="event-placeholder">
<div class="event-title">{{event}}</div>
<div class="event-details"></div>
</div>
</div>
</div>
</ion-slide-page>