我正在使用 ng-repeat 制作一个带 Angular 表格。所有这一切都有效,但在某些情况下,json 会返回一些数据,如 PA-AC-DE,我想在待定、事件和停用的表中更改它。而且我不知道我该怎么做。
<table class="table table-bordered table-hover table-striped dataTable no-footer" data-sort-name="name" data-sort-order="desc">
<tr role="row" class="info text-center">
<th ng-click="order('msisdn')">Número Teléfono</th>
<th ng-click="order('icc')">ICC</th>
<!--th>IMEI</th-->
<th ng-click="order('ActivationStatus')">Estado</th>
<th ng-click="order('sitename')">Instalación</th>
<th ng-click="order('siteaddress')">Dirección</th>
<th ng-click="order('sitecity')">Ciudad</th>
<th ng-click="order('sitezip')">Código Postal</th>
<th ng-click="order('phonedesc')">Modelo Teléfono</th>
<th ng-click="order('ContractingMode')">VBP</th>
</tr>
<tr class=" text-center" ng-repeat-start="object in filteredsites = (objects | filter:searchText) | filter:tableFilter| orderBy:predicate:reverse" ng-click="showDetails = ! showDetails">
<td>{{object.msisdn}}</td>
<td>{{object.icc}}</td>
<td>{{object.ActivationStatus}}</td>
<td>{{object.sitename}}</td>
<td>{{object.siteaddress}}</td>
<td>{{object.sitecity}}</td>
<td>{{object.sitezip}}</td>
<td>{{object.phonedesc}}</td>
<td>{{ object.ContractingMode ? 'Yes': 'No'}}</td>
</tr>
</table>
最佳答案
你可以使用过滤器
{{object.ActivationStatus | statusFilter}}
statusFilter 会是这样的:
angular.module('module', []).filter('statusFilter', function() {
return function(input) {
//switch-case
};});
关于javascript - Angular ng-repeat 变化值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30910937/