2

I have a model object in which few properties are arrays as seen below:

var Object1 = {
    Prop1 = [];
    Prop2 = null;
};

ko.track(Object1) will not track the array property Prop1. How can this array property be tracked? Currently I am doing as follows:

for (var property in Object1) {
      if (Array.isArray(Object1[property])) {
          //track each item in the array property
          trackModelArrayProperties(Object1[property]);
      }
  } 

 var trackModelArrayProperties = function (property) {
  var arrayPropObj = {
      property: null
  };
  ko.track(arrayPropObj );

 };

The above is not working because the array properties show null values after I data bind them to the input controls.

user2585299
  • 873
  • 2
  • 19
  • 41

0 Answers0