Skip to content Skip to sidebar Skip to footer

Create JSON Object From Dynamic NgModel

I have a service which returns a JSON of type array[obj1{name, usage, id}, obj2{name, usage, id}] on HTML page I am creating a form with form field = name and it is pre-populated w

Solution 1:

The reason for undefined value is that, items is an array and hence doesn't have the property usage

onSubmit {
    this.changedValues = this.items;
    console.log(this.changedValues);
}

This should give the array with updated values.


Post a Comment for "Create JSON Object From Dynamic NgModel"