<pre>{{statistics|json}}</pre>
<div class = "list">
<a class =" item"
ng-repeat="item in statistics ">
<p class="title"> {{item.token}} </p>
</a>
</div>
这是json代码:我在服务器上工作,所以你不能运行它..
app.controller('StatisticsCtrl',
['$scope',
'$auth',
'StatisticsService',
function ($scope, $auth, StatisticsService) {
var token = $auth.getToken(); //meant to cancel token undefined error
console.log('StatisticsCtrl INIT');
function run() {
var data = {
token: token,
timestamp_from: moment(new Date()).unix()-30 * 24 * 3600,
timestamp_till: moment(new Date()).unix(),
order: 'duration_minutes',
limit: 20
};
StatisticsService.getStatisticsFromServer(data).then(function (response) {
console.log('syncStatistics', JSON.stringify(response));
$scope.statistics = response; // bring response to statistics,the jason comes from here
}, function (error) {
console.error(error);
});
}
run();
}]);
我只得到了一些关于json本身的设置的感觉..