Reputation: 386
I show an overview of dates, (I simplified my example)
someArray$: Observable<Date[]> = of(
new Date(2019, 11, 1),
new Date(2019, 11, 2),
new Date(2019, 11, 3));
Then I make a call to the backend and get some data like this:
anotherArray$: Observable<MyClass[]> = of(
{date: new Date(2019, 11, 1), active: true},
{date: new Date(2019, 11, 2), active: false},
{date: new Date(2019, 11, 3), active: false});
Now I already show someArray$ with an *ngFor in my template so I thought I could combine them somehow without subscribing and then use the boolean value from the second array to visualise activity.
Upvotes: 0
Views: 100
Reputation: 7630
Follow this steps:
someArray$ = of([
{ date: new Date(2019, 11, 1) },
{ date: new Date(2019, 11, 2) },
{ date: new Date(2019, 11, 3) }
]);
import { merge } from 'rxjs';
dates$ = merge(
this.someArray$,
this.anotherArray$
);
Here is a StackBlitz DEMO (notice the active column values changing after 5 seconds)
Upvotes: 1