I want to get the length/size of my Observable and display it in the template
<p>I have an Observable in my service and I want to display its size/length as part of my pagination.</p>

<pre><code>public document: SomeClass[]

getDocument(): Observable&lt;SomeClass[]&gt; {
       return this._http.get(this.jsonURL)
            .map(this.extractData)
            .catch(this.handleError);
    }

&lt;div *ngFor='let resultItem of document; let count=index'&gt;&lt;/div&gt;

&lt;pagination&gt;{{document.length}}&lt;/pagination&gt;
</code></pre>

<p>This is throwing an error: Cannot read property 'length' of undefined </p>

<p>How should it be done? thanks for your help.</p>