Access first item of array using async pipe in Angular 2

 https://stackoverflow.com/questions/42614267/access-first-item-of-array-using-async-pipe-in-angular-2

Found an even easier way of doing it (without creating a custom pipe): add a map to the observable.

component.ts

this.activeTab$ = this.pageTabs$.map(x => x[0]);

component.html

<nav-tabs
   [tabs]="(pageTabs$ | async)"
   [activeTab]="(activeTab$ | async)">
</nav-tabs>

Không có nhận xét nào:

Is there a way to chain multiple tailwind css classes on a single hover instance?

 https://stackoverflow.com/questions/73524088/is-there-a-way-to-chain-multiple-tailwind-css-classes-on-a-single-hover-instance There is a wa...