Payload to javascript array

I have an array in template node as below.

var myContacts = [
{"rowid":1, "name": "Parvez Ansari", "email": "ansariparvez@gmai.com", "mobile":"9998979695" },
{"rowid":2, "name": "Tayyeb Shaikh", "email": "tshaikh1981@gmai.com", "mobile":"9091929394" },
{"rowid":3, "name": "Ashfaque Shaikh", "email": "ashly786@gmai.com", "mobile":"8081828384" }
];

This need to be replaced using array in payload .

I have a function in template node which will be called in onload event.
Can I iterate the payload and push it to the javascript array myContacts ?
The field in the row is not fixed ,it is as per the DB outtput.
Basically I need to copy everything in payload and create a javascript array .
Can I use mustache?.Please help.

You mat need to use the $watch feature of Angular in your tempalte code, this is the part that will watch for new incoming data and let you process it.

I have a few examples on my blog at https://it.knightnet.org.uk but there are plenty of examples elsewhere too.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.