Hey there everyone :)
I have a very silly question but I cannot seem to find an answer anywhere...
Why does ng-model for a checkbox in AngularJS require a property on an
object? Why can it not just be set to a literal value on the scope?
For example, the AngularJS documentation stipulates:
<label>Value1:
<input type="checkbox" ng-model="checkboxModel.value1">
</label><br/>
This works perfectly fine, if value1 is a property on the checkboxModel
object. But if you initialise value1 on your scope and assign the ng-model
to just value1, it no longer works. Why is that?
Thanks :)
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.