我有一個ng-repeat
元素,它將通過$http.get()
結果循環。Angular JS Date過濾器不工作
<tr ng-repeat="blog in posts">
<td style="text-align:center">{{ $index+1 }}</td>
<td>{{ blog.title }}</td>
<td>
{{ blog.author.name }}
</td>
<td>
{{ blog.created_at | date:'MMM-dd-yyyy' }}
</td>
</tr>
我created_at
在MySQL數據庫表timestamp
。我正在使用angular.js v1.0.7
。
我從數據庫表中得到相同的輸出並且日期過濾器不工作。我該如何解決這個問題?
我的Ajax調用,
$http({method: 'GET', url: 'http://localhost/app/blogs'}).
success(function(data, status, headers, config) {
$scope.posts = data.posts;
}).
error(function(data, status, headers, config) {
$scope.posts = [];
});
爲什麼沒有角度forEach – Vignesh
@Vignesh是的,我應該利用這一點。 – devo