I have successfully implemented pagination in my Angular 2 application, but I am encountering an issue related to the async pipe:
Invalid argument '' for pipe 'AsyncPipe'
Upon researching this error, it seems to be linked to the async pipe expecting an observable. The confusing part is that I am indeed using an observable, so I am unsure of what is causing the problem.
Let's take a look at the relevant view code:
<tr *ngFor="let record of records | async | paginate: { id: 'stream', itemsPerPage: 15, currentPage: page, totalItems: total }">
This component relies on an Input() from another component, demonstrated as follows:
@Input() records = [];
Here's the "records" data from the other component, which is being subscribed to OnInit:
ngOnInit() {
this.streamService.getBySection('section1')
.subscribe(resRecordsData => this.records = resRecordsData,
responseRecordsError => this.errorMsg = responseRecordsError);
}
What could be causing this issue? Do I need to explicitly specify the type as observable somewhere?