D
D
Demigodd2019-01-15 12:33:01
JavaScript
Demigodd, 2019-01-15 12:33:01

How to separate names with commas in AngularJS?

Link to JSFiddle
Now the output looks like this.
Output: Name name 1 name 2 name 3
It should look like this.
Output: Name name 1 , name 2 , name 3 .
How to correctly put commas after names and at the end with a dot ?
Maybe you need a function in the Controller that before ng-repeat collects all the names, inserts a comma at the end, then draws them in the VIew ? BUT then how to draw them each in a separate <a> tag ?
Or suggest your options, preferably in JSFiddle, Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Proskurin, 2019-01-15
@Demigodd

You can just put a comma at the end every time, except when $last === true (that is, this is the last element of the loop).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question