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

<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?

淡淡烟草味
淡淡烟草味

全部回复(1)
PHP中文网

过滤成列表的意思是?你这是要干嘛?我可以先给你改改,只是不知道这是做什么:

<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
    }
})
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号