Zabs Zabs - 1 year ago 57
AngularJS Question

Display AngularJS array to a 'human' readable string

I have outputted a variable that is an array within my view and while it is displaying the values as following :-

Inbound bound posts will contain ["phone", "car"]

How do I change this to display this in a human format eg. (as below)

Inbound bound posts will contain phone, car

Answer Source

if you simply want to list the array you can use join:

arr = ["phone", "car"];
arr.join(", ");

would output: "phone, car".

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download