確定這裏是名單:ng級的條件簡單列表?
<ul>
<li ng-click="menuclick()" ng-class="testclass">test</li>
<li ng-click="menuclick()" ng-class="testclass">test</li>
<li ng-click="menuclick()" ng-class="testclass">test</li>
<li ng-click="menuclick()" ng-class="testclass">test</li>
,這裏是我的控制器:
.controller('editcontroller', function ($scope) {
$scope.activemenufirst = 'activemenu';
$scope.menuclick = function menuclick() {
event.preventDefault();
$scope.activemenufirst = ' ';
alert('test');
};
});
我如何在li鏈接上應用一個活動類,當它被點擊並將其從所有其他li中刪除? jsfiddle