2016-07-27 39 views
1
<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> 

我試圖讓timeline__time的如何獲得下中繼轉發的所有元素

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')); 

我收到以下錯誤的時機:

Error: TypeError: this.IncList.get(...).element.all is not a function

我怎樣才能得到所有元素中繼器下的中繼器?

回答

3

這是量角器一個共同的問題,你正在做的正確鏈接,替換:

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警告有關。

+0

感謝@alecxe幫助。 – ssharma