I have the following knockoutjs code with 3 checkboxes.
The issue here is that the checkboxes are not being binded correctly with the json data.
Any clue?
HTML
<form>
<div>
<div>
<label><input type="checkbox" data-bind="checked: properties" value="1" />Property ABC</label><br/>
<label><input type="checkbox" data-bind="checked: properties" value="2" />Property CON</label><br/>
<label><input type="checkbox" data-bind="checked: properties" value="3" />Property ZZZ</label>
</div>
</div>
</form>
<hr/>
<div data-bind="text: ko.toJSON(properties)"></div>
JS
var jsonData= [1,2];
var App = function (jsondata) {
var self = this;
self.properties = ko.observableArray(jsondata);
};
var appViewModel = new App(jsonData);
ko.applyBindings(appViewModel);
Thanks