javascript - How to append object into existing object Angularjs -
i have 2 object 1 hold answer of 1 question , final object.
answer = {"value":"asda","indicator":"good"}; final = {} ;
i want append answer object final object
final = {{"value":"asda","indicator":"good"},{"value":"sdad","indicator":"worse"}}
how can ?
you can not directly append object. instead of need hold object in array following.
answer = {"value":"asda","indicator":"good"}; final = []; newobject = {"value":"sdad","indicator":"worse"};
now can push both object array -
final.push(answer); final.push(newobject);
result of -
final = [{"value":"asda","indicator":"good"},{"value":"sdad","indicator":"worse"}];
hope you.
Comments
Post a Comment