angular.js - 如何在页面中把ng-repeat遍历出来的xxx.yyy(字符串) ,过滤成数组
淡淡烟草味
淡淡烟草味 2017-05-15 17:02:33
0
1
573

<tr ng-repeat="ins in  instances">
  <td ><input type="checkbox" ng-model="icheckedList[ins.id]" ng-required="{{needOneList}}" ng-checked="all" one-least></td>
  <td><span ng-bind="ins.name"></span></td>
  <td><table><tr ng-repeat="p in ins.private_ip|privateip"></tr></table></td>
  <td ng-bind="ins.public_ip"></td>
</tr>

.filter('privateip',function() {
    return function(p) {
        p.split(',');
        return p
    }
})

其中 ins.private_ip是一个 形如 1.2.3.4,94.8.7.6 的字符串
怎么才能把 ins.private_ip 过滤成列表 p in ins.private_ip|privateip似乎是过滤的遍历出来的p?

淡淡烟草味
淡淡烟草味

répondre à tous(1)
Ty80

Que signifie filtrer dans une liste ? Que fais-tu? Je peux d'abord le changer pour vous, mais je ne sais pas ce que ça fait :

<tr ng-repeat="ins in  instances">
  <td ><input type="checkbox" ng-model="icheckedList[ins.id]" ng-required="{{needOneList}}" ng-checked="all" one-least></td>
  <td><span ng-bind="ins.name"></span></td>
  <td>
      <table>
          <tr ng-repeat="p in ins.private_ip">
              <!-- 这里输出的就是数组了 -->
              {{ p | privateip }}
          </tr>
      </table>
  </td>
  <td ng-bind="ins.public_ip"></td>
</tr>

.filter('privateip',function() {
    return function(p) {
        p.split(',');
        return p
    }
})
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!