I cannot find the correct way to set the attribute 'checked' in ons-switch. This means that I can customize the user configuration page with pre-selected selection fields.
Documents: This is a proven switch, but how to set it using a variable in an angular controller?
For example, if ons-switch has syntax like I could do:
I cannot set the "checked" attribute without a value in angular if necessary in the docs. I also cannot access the variable as it is part of the configuration array.
Code example:
controller:
var categInfo = [{Interest:'Classic', isChecked:true}, {Interest:'New', isChecked:false}];
HTML:
<ons-list-item ng-repeat="interest in categInfo" >
<span style="color: #666">{{interest.Interest}}</span>
<ons-switch modifier="list-item" var="{{interest.Interest}}" checked="{{interest.isChecked}}"></ons-switch>
</ons-list-item>
So, I want html to display buttons that are marked or not marked depending on interests. isChecked is true or false.