<script>var array_char = ["a", "b", "c", "d", "e", "f", "g",..., "z"];</script>
<tr ng-repeat="r in myModel">
<td>{{$index}}</td>
<td>{{char in alphatbet?}}</td>
</tr>
我想要第二栏中的a,b,c ......我怎样才能做到这一点?
答案 0 :(得分:0)
请阅读以下文档:ng-repeat,controllers,application bootstrap。
HTML:
<body ng-app="app">
<table ng-controller="ctrl">
<tr ng-repeat="r in myModel">
<td>{{$index}}</td>
<td>{{r}}</td>
</tr>
</table>
</body>
JS:
angular
.module("app", [])
.controller("ctrl", function($scope) {
$scope.myModel = ["a", "b", "c", "d", "e", "f", "g", "z"];
});