我试图从 3 个按钮中添加/删除一个 calss,由于某种原因,有时需要不止一次点击才能工作
<a class="button small">
<i class="icon-circle-arrow-up" ng-click="select('slide')" ng-class="{active: 'slide' == selected}"></i>
</a>
<a class="button small">
<i class="icon-resize-horizontal" ng-click="select('wave')" ng-class="{active: 'wave' == selected}"></i>
</a>
<a class="button small">
<i class="icon-repeat" ng-click="select('role')" ng-class="{active: 'role' == selected}"></i>
</a>
的JavaScript:
myApp.controller("TodoCtrl", function($scope, $http) {
$scope.slide = "one";
$scope.animate = "slide";
$scope.selected = "slide";
return $scope.select = function(item) {
$scope.selected = item;
return $scope.animate = item;
};
});
麻烦: