jeudi 18 mai 2017

Change checkbox value for checked and unchecked in AngularJS

I have a checkbox and I'd like to change the value if the checkbox is checked or not.

For the moment, my checkbox model value is equal to 'true' if checked and 'false' if unchecked.

My checkbox

<input type="checkbox" ng-model="toStringObj" />

What I tried

<input type="checkbox" ng-true-value="anyModel" ng-false-value="''" ng-model="toStringObj" />

I works if I put a string in ng-true-value directive, but not with a model, I need to pass a model from my scope




Aucun commentaire:

Enregistrer un commentaire