How to start focusing on the first ng-repeat item

Asked

Viewed 14 times

0

I have a ng-repeat and I’d like it to just start with auto focus on the first item. I just wanted the focus to start on the first item, after that I want it to work normally: As I click on the other items it changes the focus (normal behavior).

I use Angularjs 1.5. I tried to start the focus using a ng-class, tried a ng-attr-autofocus ="$first" and none of this starts with a focus on the first item.

my code:

<md-list flex class="horizontalBar">
  <md-list-item layout="row" ng-repeat="data in report track by $index" ng-click="show(data)">
    <div flex="20">
      <p class="md-body-1 line-height_1">{{data.label}}</p>
    </div>
    <md-progress-linear md-mode="determinate" value="{{(data[deals_sources_order]/total_amount[deals_sources_order])*100}}" class="progressReports"></md-progress-linear>
    <div flex="10">
      <p layout-padding="12px" class="md-title text-center">{{data[deals_sources_order]}}</p>
    </div>
  </md-list-item>
  <div class="fade" ng-if="report.length == 0" flex layout="column" layout-fill layout-align="center center" ng-include="'reports/components/f.html'"></div>
</md-list>

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.