Skip to content

Instantly share code, notes, and snippets.

@jan-matejka
Created August 14, 2012 00:34
Show Gist options
  • Select an option

  • Save jan-matejka/3345153 to your computer and use it in GitHub Desktop.

Select an option

Save jan-matejka/3345153 to your computer and use it in GitHub Desktop.
Actually, I don't know how You are using it and my comment is kinda ambiguous and I think I quite rewrote the code since I wrote the comment.
The name of checkbox refers to the attribute ng-model, not the name attribute.
The non-unique model names in makes the received value of the model quite unpredicatble after a few changes of inputs states in my code.
When using it with ng-change it causes the ng-change method NOT to fire sometimes.
I think the not-firing happens when i check an input, and then I check another input with the same model which makes the model to "change" from "checked" (from the first click) to "checked" (the second click) so there is no change and the ng-change doesnt fire.
The problem is it doesnt seem to be possible to create dynamicly named models inside the ng-repeat (as Sten Hougaard asks at http://docs.angularjs.org/api/ng.directive:ngRepeat)
I solved it by using ng-repeat with ng-click inside instead of ng-repeat with ng-model and ng-change inside.
But if you meant the plain old name attribute, I don't think I had any issue, though i later abandoned it in favor of using hidden inputs and setting their value from js.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment