I'm struggling to figure out how to retrieve the number of elements in an array-like Observable without getting back another Observable. I've spent a lot of time experimenting with different operators, but none have been successful.
Here's my current code snippet:
entities: Observable<entity>;
let data = await this.myService.filter(2)
.subscribe(d => {this.entities= d; })
I am using Angular HttpClient, which directly sends an Observable from the response. The service code is quite straightforward:
filter(arg: int): Observable<any> {
return this.http.get<entity>('/api/ent/find/' + arg.toString());}
The entities Observable is typically loaded with multiple entities that I use in a grid. All I need is something like
howMany: number = entities.count() or entities.length()..
.
To get the quantity for use in the component (not display). However, every approach I've tried has resulted in returning an Observable instead of a simple number.