我仍然很有角度,所以这可能是一个基本问题,但我还没有弄明白.
如何将一个复选框(绑定到我的模型的属性)放入一个angular-ui手风琴的标题中?我可以在那里找到复选框,但点击似乎永远不会达到它,即它永远不会被“检查”.
<accordion> <accordion-group ng-repeat="group in groups" is-open="group.open"> <accordion-heading> <input type="checkBox" ng-model="group.checked" ng-click="checkBoxClick(group,$event)" /> Title </accordion-heading> {{group.content}} </accordion-group> </accordion>
根据这个jQueryUI accordion with checkboxes,通过在click事件上调用e.preventDefault(),我可以通过标准jquery-ui手风琴获得类似所需行为的东西,但这似乎不适用于angular-ui手风琴指令.
在这里看到这个plunker:http://plnkr.co/edit/QMnaXJeMagrTPRjbIZbL?p=preview.
<accordion> <accordion-group ng-repeat="group in groups" is-open="group.open"> <accordion-heading> <input type="checkBox" ng-checked="group.checked" ng-click="checkBoxClick(group,$event)" /> {{group.title}} </accordion-heading> {{group.content}} </accordion-group>
和:
$scope.checkBoxClick = function(group,$event){ $event.stopPropagation(); }
示例:Plunker