我在主页上有一个链接到另一个页面的按钮。点击该按钮时,我想从一个div中删除类。单击事件时,Ng级删除类
控制器:
$scope.myClass = ["container","gnc1"];
$scope.removeClass = function() {
$scope.myClass.splice(1, 2);
}
我使用的UI的路由器这样的:
<body ui-view="viewA">
<div ng-class="myClass">
<div ui-view="viewC">
<div ui-view="viewB">
<a ui-sref="B"> </a> //Loads the B.html to where viewB is. ControllerB
<a ui-sref="C" ng-click="removeClass()"> </a> //Loads the C.html where viewC is. controllerC
</div>
</div>
</div>
</body>
按钮:
<a ng-click="removeClass()"></a>
缺少什么我在这里?我该如何删除“gnc1”类?
编辑-1:
<div ng-class="{container:dogru, gnc1:yanlis}">
indexCtrl:
$scope.dogru = true;
$scope.yanlis = true;
按钮所属controllerC所以在controllerC:
$scope.removeClass = function($scope) {
$scope.dogru = true;
$scope.yanlis = false;
}
但这没有工作无论是。我错过了什么?
http://jsfiddle.net/arunpjohny/jae7odee/2/ - 看起来只有精细 –
@Arun P约翰尼拉啊对不起,请单击EVET触发一些其他的东西太多,我忘了。点击该按钮后,控制器会改变。我要更新我的问题。 – Nasuh
更新并分享小提琴重新创建您的问题 –