ng-change get called without even change.
With default html input checkbox if there is ngChange directive placed, ngChange will not get called untill there is a change. But with your directive, it gets called automatically with the page loads for the first time without user interaction. This seems to me a bug as it is supposed to work exactly like html checkbox. I am having issue with it.
I have the same problem. :(
Hi (sorry for the very late reply),
could you please provide an example for this problem? I tried to proove it with the supplied test application and could not reproduce it.
To reproduce it, just place an ng-change event on your directive and do a alert within ng-change. Then refresh page, when page get load you will see a alert. If it happens, issue is confirmed. ng-change should only called when there is a change. Let me know if you are able to regenerate it after it.
Here is a simple example with ng-change, which does not trigger it on load: https://jsfiddle.net/83ncr2kr/3/
I have the exact same problem...
Could you provide an example which shows the problem?
yes: https://jsfiddle.net/544342zL/1/ Run the code and see :) It's a relation between the repeat and the ng-model. if you remove the "thevalue" from the ng-model it stops.
The Problem is, that "a1", "a2", ... are no valid values for the checkbox. See here for a working version: https://jsfiddle.net/da2z3wgb/
i understand what you're saying.. but it's not very functional in specific cases.. in my case i wasn't using those kind of values, i was using 0 and 1 instead of true or false, and works with normal checkboxes. again, in my case i'm receiving a json generated by ajax/mysql, and mysql doesn't have a proper true or false field type, you must use tinyint which returns 0 and 1 values. Could you set it to use 0 and 1 to? :)
See here: https://jsfiddle.net/hppg6sax/
The 0 and 1 values come as numeric, not string... https://jsfiddle.net/78ynhjbs/
I will look into it
thx :)
Hi All, anyone come up with a solution to this? The issue is because of invalid values into the model tied to?