Having a problem with HTML data-bind setter. I want it to set to model(exerciseCategories) intervals value. If I bind to intervals from model it is the right value but is not observable. If I bind it to $parent.intervals it is default value (1) from viewModel but it is observable. I want both :). What am I doing wrong? Something like this does work but displays [object Object]:
<td data-bind='with: exercise'>
<input data-bind='value: $parent.intervals(intervals)' />
</td>
What I've got is - HTML
...
<td>
<select data-bind='options: exerciseCategories , optionsText: "category", optionsCaption: "Izberite...", value: exerciseType'></select>
</td>
<td data-bind="with: exerciseType">
<select data-bind='options: exercises, optionsText: "title", optionsCaption: "Izberite...", value: $parent.exercise'></select>
</td>
<td data-bind='with: exercise'>
<input data-bind='value: $parent.intervals' />
</td>
...
JavaScript
var exerciseCategories = [
{
exercises: [{
title: 'Aerobic exercise #1',
intervals: 2
}],
category: 'Aerobics'
}];
var Exercise = function () {
var self = this;
self.exerciseType = ko.observable();
self.exercise = ko.observable();
self.intervals = ko.observable(1);
};