循环li, 动态添加当前类

 

html:

  <div class="todayEnergyTab">
     <ul>
         <li ng-repeat="item in todayEnergyChart" ng-click="getTodayEnergyChart($index,item)" ng-class="{'current': $index === isSelected}">{{item.name}}</li>
     </ul>
  </div>

 

 

js: 

 

  $scope.isSelected = 0

   $scope.getTodayEnergyChart = function (index,item) {
      $scope.isSelected = index
      // console.log(index,item)
      // console.log($scope.isSelected)
   }

 

上一篇:Docker 下使用Weave Scope监控容器


下一篇:基于web的机票管理系统设计与实现(二)