Zabs Zabs - 19 days ago 5
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

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

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

would output: "phone, car".