1、ng-click操作选择器
<div class="category-tab "> <ul id="categoryDiv"> <li id="rootli{{item.CategoryId}}" ng-repeat="item in rootList" ng-class="{true: 'cur',false: ''}[$index+1===1]"> <a href="" ng-click="setRoot(item.CategoryId)">{{item.CategoryName}}</a> </li> </ul> </div> $scope.setRoot = function (val) { angular.element(document.querySelector('#categoryDiv')).find("li").removeClass('cur'); angular.element(document.querySelector("#rootli" + val)).addClass('cur'); };