我試圖顯示來自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