条件:用字形替换值

Conditionals: Replacing a value with a glyphicon

我正在尝试做到这一点,如果在我的 table 中状态是 'R',那么它将用字形 glyphicon glyphicon-alert 替换 'R'。

我想过不同的方法来做到这一点,比如让它成为真或假条件,因为 'G' 出现是没有必要的(如果它是 [=25=,你可以帮助实现它) ] display ' ' 这也很有用)但是我在这方面没有取得太大进展。

有人可以帮忙吗?

这是相关代码的 plnkr。

http://plnkr.co/edit/CTRlMFnw4bxXy8wYHTSP?p=preview

<tbody>
         <tr class="tt" data-toggle="tooltip" title="Click for more information on {{x.c}}." ng-click="isCollapsed = !isCollapsed" ng-repeat-    start="x in projects | filter:query | filter:myFilter | orderBy:orderProperty">
            <td class="shrink"><b>{{x.a}}</b></td>
            <td class="shrink">{{x.b}}</td>
            <td class="shrink"><u>{{x.c}}</u></td>
            <td class="shrink">{{x.d}}</td>
            <td class="shrink">{{x.e}}</td>
            <td class="shrink">{{x.f}}</td>
        </tr>

        <tr collapse="isCollapsed" ng-repeat-end="">
          <td colspan="6">
              <h3>Test</h3>
              <p>Test</p>
          </td>
        </tr>
</tbody>

我会这样修复它

<tr class="tt" data-toggle="tooltip" title="Click for more information on {{x.c}}." ng-click="isCollapsed = !isCollapsed" ng-repeat-start="x in projects | filter:query | filter:myFilter | orderBy:orderProperty">
   <td ng-class="{'glyphicon glyphicon-alert': x.a == 'R'}"><b ng-if="x.a != 'R'">{{x.a}}</b></td>
   <td class="shrink">{{x.b}}</td>
   <td class="shrink"><u>{{x.c}}</u></td>
   <td class="shrink">{{x.d}}</td>
   <td class="shrink">{{x.e}}</td>
   <td class="shrink">{{x.f}}</td>
</tr>