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:
Đăng nhận xét