我试图显示来自JSON对象的数据。试图显示来自json ng-repeat的数据
<table ng-controller="statsCtrl">
<tr ng-repeat="stat in stats">
<td>{{ stat.name }}</td>
<td>{{ stat.id }}</td>
</tr>
</table>
用下面的代码
'use strict';
angular.module('stats', [])
.controller('statsCtrl', ['$scope', function($scope){
$scope.stats = [
{
name: 'player',
id: 1,
skills: [{
taming: 244,
mining: 25,
woodcutting: 100
}],
}
];
}]);
但是这是index.html的不显示任何看法。
{{ stat.name }} {{ stat.id }}
而且我得到了following error。
不知道为什么。我究竟做错了什么?
第一次搞AngularJS。
您的代码似乎是正确的。我认为错误来自另一个问题 – Thierry 2014-12-04 19:50:58