Timeline for How to push JSON records into an empty array as individual elements [Angular]
Current License: CC BY-SA 4.0
12 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jan 15, 2020 at 10:21 | comment | added | Roberto Zvjerković | Because that pushes an array into array. You are creating an array of which the first and only element is another array. | |
| Jan 15, 2020 at 10:20 | comment | added | Tanzeel |
but I still wonder, why my this.users.push(json) was not working?
|
|
| Jan 15, 2020 at 10:19 | history | edited | Roberto Zvjerković | CC BY-SA 4.0 |
added 285 characters in body
|
| Jan 15, 2020 at 10:19 | comment | added | Roberto Zvjerković | And this: developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/… | |
| Jan 15, 2020 at 10:18 | comment | added | Roberto Zvjerković | I mean, that's just how push and concat work. Read these two links: developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/… developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/… | |
| Jan 15, 2020 at 10:17 | comment | added | Tanzeel | Yes. It is working. Some stupid mistakes from my side. Sorry. Can you please explain the solution little bit more. | |
| Jan 15, 2020 at 10:17 | vote | accept | Tanzeel | ||
| Jan 15, 2020 at 10:15 | comment | added | Roberto Zvjerković | It does work. stackblitz.com/edit/angular-snwvxn?file=src/app/card/… | |
| Jan 15, 2020 at 10:13 | comment | added | Tanzeel |
this.users = json; Not working :-( let's try your other solutions.
|
|
| Jan 15, 2020 at 10:11 | history | edited | Roberto Zvjerković | CC BY-SA 4.0 |
added 59 characters in body
|
| Jan 15, 2020 at 10:10 | comment | added | Tanzeel |
yes yes, Later I'll use HttpClient only. Here I used fake rest api to quickly recreate the problem. :-)
|
|
| Jan 15, 2020 at 10:09 | history | answered | Roberto Zvjerković | CC BY-SA 4.0 |