angular.js - How to filter the xxx.yyy (string) traversed by ng-repeat into an array in the page
淡淡烟草味
淡淡烟草味 2017-05-15 17:02:33
0
1
624

<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
    }
})

Where ins.private_ip is a string in the form of 1.2.3.4,94.8.7.6
How can ins.private_ip be filtered into a list p in ins.private_ip|privateip seems to be the p that is filtered and traversed?

淡淡烟草味
淡淡烟草味

reply all(1)
Ty80

What does filtering into a list mean? What are you doing? I can change it for you first, but I don’t know what it does:

<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
    }
})
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template