[英]Alternative way to display hour in AM/PM format in a table row-wise per hour 12 AM to 11 PM in angular JS
HTML代碼
<div ng-app="myApp">
<div ng-controller="MyCtrl">
<table>
<tr ng-repeat="item in data">
<td>{{item}}</td>
</tr>
</table>
</div>
</div>
js文件如下:
var app=angular.module('myApp', []);
function MyCtrl($scope) {
$scope.data.push("12 AM");
for (var i=1; i<12; i++) {
$scope.data.push(i+" AM");
}
$scope.data.push("12 PM");
for (var i=1; i<12; i++) {
$scope.data.push(i+" PM");
}
}
這可以正常工作,但是在AngularJS中執行此操作的任何其他方法將不勝感激。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.