[英]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.