I have a Observable that I am trying to filter but I cannot seem to get it to display properly in my view.
comments = new Rx.BehaviorSubject([
{body: 'foo', commentable_type: 'Client'},
{body: 'foo', commentable_type: 'Client'},
{body: 'foo', commentable_type: 'Purchase'},
{body: 'foo', commentable_type: 'Client'},
{body: 'foo', commentable_type: 'Payment'},
]);
comments$ = comments.asObservable();
clientCommentStream$ = this.comments$.filter(comment => comment['commentable_type'] === 'Client');
and in my view, this works perfectly:
<li *ngFor="let comment of comments$ | async">
{{ comment.body }}, {{ comment.commentable_type }}
</li>
but this displays nothing:
<li *ngFor="let comment of clientCommentStream$ | async">
{{ comment.body }}, {{ comment.commentable_type }}
</li>
My stack blitz shows that the filtering is working, but it won't display because it seems the structure of the object has changed. Any insight would be helpful.
*ngForexpects an array, not a sequence of individual items.scanshould do that as far as I remember.