angular
I have a pretty basic scenario (somewhat new to angular). I am trying to convert JSON:
[
{\'name\': \'Nick\'},
{\'name\': \'David\'},
{\'name\':
Here's another approach that's more maintainable using Filters:
app.filter('commaSeparated', function () {
return function(input, property) {
var csv = '';
for (var i = 0; i < input.length; i++) {
csv += input[i][property];
if (i < input.length - 1) {
csv += ',';
}
}
return csv;
};
});
Obviously, you can replace the literal array with your $scope.menuItems...
{{ [ {'name': 'Nick'}, {'name': 'David'}, {'name': 'John'} ] | commaSeparated:'name' }}