我對Angular ng-repaet和JSON文件有點問題。吳重複不顯示任何內容。AngularJS ng-repeat不顯示JSON數組
這裏是我的JSON文件(articles.json):
[
{"id":"1", "name" : "Pizza Tobmes", "price" : 3.50},
{"id":"2", "name" : "Pizza Freddy", "price" : 2.90},
{"id":"3", "name" : "Pizza Unicorn", "price" : 6.66},
{"id":"4", "name" : "Pizza Doppel Unicorn", "price" : 12.00},
{"id":"5", "name" : "Schnitzel Unicorn", "price" : 15.33}
]
這裏是我的HTML部分:
<table ng-controller="ArticlesCtrl as art">
<th>Nr.</th>
<th>Name</th>
<th>Preis</th>
<tr ng-repeat="article in articles">
<td>{{article.id}}</td>
<td>{{article.name}}</td>
<td>{{article.price | currency : '€ '}}</td>
<td><a href class="btn btn-default btn-sm"
>Hinzufügen</a></td>
</tr>
</table>
而且finaly我app.js
function() {
'use strict';
angular.module('UnicornPizzaService', [])
.controller('ArticlesCtrl', function($scope, $http){
$http.get('articles.json').then(function(response) {
$scope.articles = response.data;
});
});
})();
我唯一看到的是「hinzufügen」按鈕的正確計數。我不知道有什麼問題,我該如何解決它?