How to remove specific element from Observable>

前端 未结 4 1127
你的背包
你的背包 2020-12-15 20:22

There is an Observable of the array of places:

places: Observable>;

In template it used with the async pipe:

4条回答
  •  别那么骄傲
    2020-12-15 20:50

    You can take advantage of filter operator:

    this.places$
            .pipe(
                map(places => {
                    // Here goes some condition, apply it to your use case, the condition only will return when condition matches
                    return places.filter(place => place.placeId !== 0);
                }),
                map(response => (this.users$ = of(response)))
            )
            .subscribe(result => console.warn('Result: ', result));
    

提交回复
热议问题