I don't need a Subject. I was a little confused. I forgot about using the 
return statement inside the map operator. 
I kept wanting to assign the response body to a variable. This little bit 
of code did the trick:
        tap((response: HttpResponse<Member[]>) => {
          this.totalCount = 
JSON.parse(response.headers.get('X-Pagination')).totalCount;
        }),
        map((response: HttpResponse<Member[]>) => {
          return response.body;
        }),

I'm still wrapping my head around Angular :)
Thanks for your help.
Dave

On Friday, February 15, 2019 at 11:12:14 AM UTC-5, helloworl...@gmail.com 
wrote:
>
> $: Observable<HttpResponse<Member[]>>;
>
> Hi, I have a members directory that works great using subscribe(), but I 
> keep reading that using the async pipe is better. So I'm trying to 
> implement that instead. I understand the basic examples. The problem is, my 
> method in my service class for returning members returns 
> Observable<HttpResponse<Member[]>>
> This is because I set the observe property: observe: 'response'
> (I need the whole response for pagination)
> On the component end, normally I would declare a variable like so:
> members$: Observable<HttpResponse<Member[]>>;
> Then when I call the get method: this.members$ 
> = this.dataService.getMembers...
> And in the html: *ngFor="let member of members$ | async"
>
> But I'm returning the whole response. What is the best way to handle this? 
> Can I use the map operator to cast the response body to the observable? 
> Should I just stick with using subscribe()? Please help, I'm a bit confused.
> Thanks,
> Dave 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to