I am trying to dynamically create observables but its not quite working. Here is what I have:
//this type works
this.Name = ko.observable(data.Name);
this.Age = ko.observable(data.Age);
//This is what I want to work
for (var propertyName in data) {
this.propertyName = ko.observable(propertyName);
}
This produces just the property name i.e "Name", and "Age" but the first one produces the value and name when I debug like "Name" is "John".