Closed nonplus closed 10 years ago
When using the join filter, sometimes I'd like to be able to specify a custom separater for the last two elements.
join
This template:
<pre ng-init="x = ['parsley', 'sage', 'rosemary', 'thyme']"> {{ x | join : ', ' }} {{ x | join : ', ' : ' and ' }} </pre>
would produce the following output:
parsley, sage, rosemary, thyme parsley, sage, rosemary and thyme
If you're interested, I can make that change and send you a PR.
join is thought to provide a filter interface for the Array.prototype.join method, so I wouldn't go with that. You can instead use a custom function on your $scope or a custom filter.
Array.prototype.join
$scope
When using the
join
filter, sometimes I'd like to be able to specify a custom separater for the last two elements.This template:
would produce the following output:
If you're interested, I can make that change and send you a PR.