I'm trying to have a box checked by default with a custom value.
Are you ready? <input type="checkbox" ng-model="checked" ng-init="checked=true" ng-true-value="sure" ng-false-value="nope"><br/>
<tt> {{checked}}</tt><br/>
If I set it to that nothing displays until I click the box. Is there a way to where it can be checked with a default value being something other than a boolean value?
ng-true-value="sure"
. So, ng-init="checked='sure'"
Code Snippet
<input type="checkbox" ng-model="checked" ng-init="checked='sure'" ng-true-value="sure" ng-false-value="nope">
Plunkr - http://plnkr.co/edit/ejYSsyIjMZSZua9cQyv1?p=preview
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With