I have an Observable in my service and I want to display its size/length as part of my pagination.
public document: SomeClass[]
getDocument(): Observable<SomeClass[]> {
return this._http.get(this.jsonURL)
.map(this.extractData)
.catch(this.handleError);
}
<div *ngFor='let resultItem of document; let count=index'></div>
<pagination>{{document.length}}</pagination>
This is throwing an error: Cannot read property 'length' of undefined
How should it be done? thanks for your help.