vendredi 19 juin 2015

Show the inverse state of a model in a checkbox

Let's say I have a model such as:

required: bool

and a checkbox labeled Optional [x].

When the model value of required is true, Optional should be unchecked, and vice versa.

Is there a way I can bind the required model value to a checkbox, but invert the shown value and the value that would be set when the checkbox is clicked?

I know I can create a $watch and do the thing on my own, but I thought maybe Angular provides some facility for that kind of stuff.




Aucun commentaire:

Enregistrer un commentaire