I want to generate comma separated string from an array.
This is my data:
responseData= [{ name: 'Some Data 1', type:'action' },
{ name: 'Some Data 2', type:'action' },
{ name: 'Data 3', type:'NA' },
{ name: 'Data 4', type:'action' },
{ name: 'Data 5', type:'NA' }];
This is how I'm looping. I only want to loop through action
type.
<div *ngFor="let data of responseData; let last=last">
<div *ngIf="data.type=='action'">
{{ data.name}} {{last?'':', '}}
</div>
</div>
But I'm left with another comma at last. How do I remove that?
Any help would be much appreciated. Thanks!