<item id="item-1" class="item ng-scope" ng-repeat="incident in $ctrl.allIncidents track by incident.dg_guid"><div role="tablist" class="panel-group" ng-transclude="">
<div class="panel ng-scope ng-isolate-scope panel-default panel-open" ng-class="panelClass || 'panel-default'" is-open="$ctrl.isExpanded" style="">
<div id="accordiongroup-1970-6335-panel" aria-labelledby="accordiongroup-1970-6335-tab" aria-hidden="false" role="tabpanel" class="panel-collapse in collapse" uib-collapse="
<!-- ngIf: $ctrl.showTextArea -->
<div>
<!-- ngRepeat: event in $ctrl.timeline.filterBy track by $index --><div class="incident-details__description-text flex-space-between ng-scope" ng-repeat="event in $ctrl.timeline.filterBy track by $index">
<div>
<!-- ngRepeat: time in event.date track by $index --><div class="timeline__time__container ng-scope timeline__container-first" ng-repeat="time in event.date track by $index" ng-class="{'timeline__container-first': $first}">
<span class="timeline__time ng-binding">8:39 PM</span><br>
</div><!-- end ngRepeat: time in event.date track by $index --><div class="timeline__time__container ng-scope" ng-repeat="time in event.date track by $index" ng-class="{'timeline__container-first': $first}">
<span class="timeline__time ng-binding">07/26/16</span><br>
</div><!-- end ngRepeat: time in event.date track by $index -->
</div>
</div>
</div><!-- end ngRepeat: event in $ctrl.timeline.filterBy track by $index --><div class="incident-details__description-text flex-space-between ng-scope" ng-repeat="event in $ctrl.timeline.filterBy track by $index">
<div>
<!-- ngRepeat: time in event.date track by $index --><div class="timeline__time__container ng-scope timeline__container-first" ng-repeat="time in event.date track by $index" ng-class="{'timeline__container-first': $first}">
<span class="timeline__time ng-binding">7:08 PM</span><br>
</div><!-- end ngRepeat: time in event.date track by $index --><div class="timeline__time__container ng-scope" ng-repeat="time in event.date track by $index" ng-class="{'timeline__container-first': $first}">
<span class="timeline__time ng-binding">07/25/16</span><br>
</div><!-- end ngRepeat: time in event.date track by $index -->
</div>
我正在尝试获取时间表的时间
this.IncList = element.all(by.repeater('incident in $ctrl.allIncidents track by incident.dg_guid'));
this.FirtstIncTimeLine = this.IncList.get(0).element.all(by.repeater('event in $ctrl.timeline.filterBy track by $index'));
this.FirtstIncTopTimeLine = this.FirtstIncTimeLine.first();
this.FirtstIncTopTimeLineTime = this.FirtstIncTopTimeLine.element.all(by.css('span.timeline__time'));
我收到以下错误:
错误:TypeError:this.IncList.get(...)。element.all不是函数
我怎样才能在Repeater下获得Repeater的所有元素?
最佳答案
这是量角器中的常见问题,您做错了链接,请更换:
this.IncList.get(0).element.all(by.repeater('event in $ctrl.timeline.filterBy track by $index'));
与:
this.IncList.get(0).all(by.repeater('event in $ctrl.timeline.filterBy track by $index'));
仅供参考,如果有兴趣,我是currently working on making these kind of problems caught by static code analysis and
ESLint
。附带说明,请勿在中继器定位器中使用“跟踪依据”:
this.IncList.get(0).all(by.repeater('event in $ctrl.timeline.filterBy'));
我已经实现了the
ESLint
rule来警告这一点。关于testing - 如何在转发器下获取转发器的所有元素,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38617587/