Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
45
rated 0 times [  49] [ 4]  / answers: 1 / hits: 20763  / 8 Years ago, thu, november 10, 2016, 12:00:00

i have two object one is for just to hold answer of one question and another is final object. like



  answer = {value:asda,indicator:good};
final = {} ;


i want to append answer object to final object like this



final = {{value:asda,indicator:good},{value:sdad,indicator:worse}}


How can i do that ?


More From » angularjs

 Answers
30

You cannot directly append an object. Instead, you need to hold object in an array like following.



answer = {value:asda,indicator:good};
final = [];
newObject = {value:sdad,indicator:worse};


now you can push both object to array like -



final.push(answer);
final.push(newObject);


Result of this will be -



final = [{value:asda,indicator:good},{value:sdad,indicator:worse}];

[#60113] Tuesday, November 8, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ronans

Total Points: 460
Total Questions: 109
Total Answers: 108

Location: Slovenia
Member since Sat, Sep 11, 2021
3 Years ago
;