Can someone explain how to include Observable<News>
in an array of observables?
newsArray: Observable<Array<any>>;
addNews(newsId: number) {
let news = this.newsService.getNewNews(newsId); // this results in an Observable<News>.
//How can I add `news` to `newsArray` so it can be shown in the UI?
}
HTML:
<li *ngFor="let item of (newsArray | async)">
<div>{{item.Id}}: {{item.DataValue}}</div>
</li>
Are there any other operators that would help in this situation?
I attempted to use BehaviourSubject
but it only displays one value at a time. I want to showcase all items being added to the array.