<span ng-repeat="tag in tags">
{{tag + "," }}
</span>
I need to remove ,
after the last element. I know ng-if="$last"
can solve the problem. But, as I don't have any parent element for {{tag}}
I can't use ng-if
so, just need some work around.
You should use a ternary together with ()
in order to prevent weird outcome:
<span ng-repeat="tag in tags">
{{tag + ($last ? "" : ",")}}
</span>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With