所以我想acomplish這個例子:http://jsfiddle.net/pkozlowski_opensource/WXJ3p/15/AngularJS - 納克單擊單擊時沒有刪除以前的點擊的修改再次
然而,由於某些原因,當我點擊一個DIV,然後在另一個,它不會從前面的div中刪除「active」類,因此它會突出顯示兩者,因此,如果單擊所有div,則所有div都會顯示活動類。我想讓它到達實際刪除類的地方,如果我點擊正文的其他任何地方,以及如果我點擊任何其他div,如小提琴示例。
我的jsfiddle http://jsfiddle.net/GeorgiAngelov/jUj56/4/
<div ng-controller="MyCtrl">
<button class="addQuestionButton btn btn-primary" ng-click="AddRootQuestion(questions)">Add node</button>
<div ng-repeat="question in questions" ng-include="question"> </div>
<script type="text/ng-template" id="question">
<!-- Single question starts here -->
<div ng-controller="QuestionController" ng-class="{active : isSelected(question)}">
<button class="btn btn-primary" ng-click="AddSubQuestion(question)">Add node</button>
<button class="btn btn-primary" ng-click = "editQuestion(question)">Edit Question</button>
</div>
<div ng-repeat="question in question.nodes" ng-include="question">
</div>
</script>
</div>
你可以爲此製作plunkr嗎? – SET
我剛剛添加jsFiddle到我的文章。 –