Search code examples
angulartypescriptrxjsngrx-storengrx-store-4.0

@ngrx/store select - How to convert Observable<Array<StaffInterface>> to Array<StaffInterface>


tying to get Array<StaffInterface> from a Observable<Array<StaffInterface>> in ngrx store.select which returns the Observable<Array<StaffInterface>> so that i can pass the Array<StaffInterface> to primeng datatable.

staffList: Array<StaffInterface>; 
this.staffList = store.select(staffList);

In the above assignment store.select returns Observable<Array<StaffInterface>>. I need to convert it to Array<StaffInterface>


Solution

  • Use the async pipe in your template.

    https://angular.io/api/common/AsyncPipe