unchecking checkbox
I'm using angularjs as much as possible - I'm editing some legacy system and I cannot afford to change too much. So, basically, I need to implement a function that unchecks every checkbox in the page. The easiest solution - without changing too much of the existing system - was to use angular.element
. Now I know, this is a REALLY bad solution, but I need to make it work.
Currently, it works (visually at least), since every checkbox gets unchecked, however, on another click the checkbox doesn't work - it needs to be pressed twice, before being activated again.
Here's a demo of how things are and how I've implemented a partial solution: http://jsbin.com/xicubegira/1/edit?html,js,output Use case is as follows.
So, how could I uncheck all checkboxes in the page and still maintain initial functionality? I'm guessing the issue here is, that nothing changes in scope of checkbox, so ng-change
doesn't get fired.
Thanks for your help!
Your issue here is that you'r not changing your model so ng-change cannot be called since the data hasn't change.
Can't you do a simple set to false of your model :
$scope.uncheck = function(){
$scope.confirmed = false;
};
链接地址: http://www.djcxy.com/p/71030.html
上一篇: 如何仅检查列表中的过滤项目
下一篇: 取消选中复选框