Reputation: 720
I am fetching data from an api which is giving me table content in form of array of arrays where first array has all the column names and subsequent ones have the data. Now I want to display the first array elements in thead
and rest in tbody
. As far I have tried using | slice:0:1;
but for setting the lastindex I am not sure what keyword will be used. Like | slice : 1 :?
. Or is there any better approach to do so using native angular keywords ?
Upvotes: 1
Views: 57
Reputation: 14219
The last parameter is optional. Not providing an end index will get a slice of the array from the start index to the end of the array. See the docs
Example:omitted: return all items until the end.
<tr *ngFor="someArray | slice : 1">
<!-- Details -->
</tr>
Upvotes: 4