AngularJs在ng-class中使用ng-init变量

时间:2016-12-27 14:11:43

标签: angularjs ng-class ng-init

所有样式都适用于结果。 这个选择有什么问题?

 <div  ng-init="selectedItem = elements">
   <div class="nav-item" ng-class="{'someStyle' : selectedItem === elements}" 
        ng-click="selectedItem = elements" ></div>
   <div class="nav-item"  ng-class="{'someStyle' : selectedItem === inspector}" 
        ng-click="selectedItem = inspector" > </div>
   <div class="nav-item" ng-class="{'someStyle' : selectedItem === pages}" 
         ng-click="selectedItem = pages" > </div>
</div>

0 个答案:

没有答案