Template.body.viewmodel({
// here items is an array but you can use a function
// that returns the results of a collection query.
items: [
{ letter: "A", value: 1 },
{ letter: "B", value: 2 },
{ letter: "C", value: 3 }
],
selectedValues: [],
sum: function () {
return this.selectedValues().reduce(function(p, c) { return parseInt(p) + parseInt(c) }, 0);
}
});
Maybe we should not be expressed.
The collection of data I have a property called “gender” and it may have value: “female” or “male”.
My question is, what to do to show you on the numerical value indicating how many times the property of “gender” is “woman” and how many times the property of “gender” is “man”.