加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Angularjs 双重循环获取父级下标$index

发布时间:2020-12-17 09:12:23 所属栏目:安全 来源:网络整理
导读:Html代码 table class = "tabletable-bordered" tr ng-repeat = "infointtzInfo" ng-cloak td class = "col-xs-2adjust-col-2text-righttitle-desc" ng-bind = "info.title" / td td class = "col-xs-3adjust-col-3text-center" ng-repeat = "keyin['ttz','y
Html代码
  1. <tableclass="tabletable-bordered">
  2. trng-repeat="infointtzInfo"ng-cloaktdclass="col-xs-2adjust-col-2text-righttitle-desc"ng-bind="info.title"></tdtdclass="col-xs-3adjust-col-3text-center"ng-repeat="keyin['ttz','yeb','bank']"spanng-if="info[key]"spanng-if="info[key].length"ng-bind="info[key]"ng-class="{'year-interest':$parent.$parent.$parent.$first}"spanspanng-if="!info[key].length"class="glyphiconglyphicon-ok"spanng-if="!info[key]"class="glyphiconglyphicon-remove"trtable>

直接获取父级下标,只有两个ng-repate写在一起的时候,使用 $parent.$index即可获取,若没多一级ng-if之类的判断条件,则接着在往上一级寻找即可。

其他ng-repate的函数都是同一个道理。

Angularjs在线教程:

http://each.sinaapp.com/angular/tutorial/ng-repeat.html

Variable Type Details
$index number iterator offset of the repeated element (0..length-1)
$first boolean true if the repeated element is first in the iterator.
$middle boolean true if the repeated element is between the first and last in the iterator.
$last true if the repeated element is last in the iterator.
$even true if the iterator position$indexis even (otherwise false).
$odd $indexis odd (otherwise false).
转自: http://qiaolevip.iteye.com/blog/2242113

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读