I wish to compare 2 observable arrays. I have defined 2 observable arrays as below
var data1 = [{name1: "one"}, {name1: "two"}, {name1: "three"}];
var data2 = [{name2: "one"}, {name2: "two"}, {name2: "three"}];
dataOne: ko.observableArray(data1),
dataTwo: ko.observableArray(data2)
You can see data1 has different element name than data2. I wish to compare 2 observable arrays and return data matching with each other. So in our case it will be "two" and "three"
After doing this i will bind this to checkbox which will set checkbox to checkbox with matching data. I have put up fiddle here
I want to bind the checkbox with value from observable array dataTwo. How to achieve this?
Forgot to mention that in my fiddle i have just one checkbox but in my actual scenario it will be multiple checkboxes which will be binded to the data.
I have now updated fiddle. You can see that i am binding checkbox to dataOne but want to be checked based on element in datatwo.