benlesh on master
docs: fix typo word 'occurrance… (compare)
benlesh on master
docs(observable.md): add missin… (compare)
benlesh on master
docs(delayWhen): improve docs r… (compare)
tap(()=> statusSubject.next(loading)),
map(accounts => {
return accounts.map(account => {
if (account.productType === AccountSummaryJO.ProductTypeEnum.FRUITS) {
return this.store.pipe(select(fromFruits.getFruit(account.fruitId), take(1)));
} else {
return observableOf(account)
}
})
}),
combineAll(),
This is what i am trying
from + concatMap + toArray
Hi all.
So, observables are lazy, which means they don’t have the built-in caching that promises have.
So let’s say I need to request two resources from the server, then when they arrive execute a function that uses the two results.
Let’s also say that I’m going to repeat that request, but this time I can reuse one of those earlier results to save an HTTP call.
With promises this is trivial, but I’m not seeing an intuitive-looking way to do this with observables. I assume this is a fairly common thing … is there a widely-used pattern for such things?
Thank you in advance!
const foo = ["alpha", "bravo", "charlie"]
// With these types below
const fooObj = foo.reduce((acc, curr) => /* convert to object */)
/*
But fooObj now has type of
= {
alpha,
bravo,
charlie
}
*/
Hi,
I'm using rxjs in an angular application, which is chaining several combineLatest() observables.
The source observable finishes with a share() (so that the observable is replayed to new subscribers?)
The trouble I'm having is that when I subscribe to the observable in my component I am not seeing extra values that are being added via one of the many combinedLatest calls. The values appear to be in the chain of commands. I log them via tap, however my the output from my subscription appears in the console boefore those log messages and doesn't appear to include the values I suggest should be there.
my code is something like this
obs1$ = obs$.pipe(
map( /* some operation */),
share()
)
obs2$ = combineLatest(
[$obs1, $actionx] )
.pipe(
map(/* reduce the data some way*/)
)
obs3$ = combineLatest(
[ obs2$, newdata$])
.pipe(
map(/*insert new data*/)
)
obs3$.subscribe(data => this.myappdata = data)
My current thoughts are that it does seem as though I'm overusing combine latest, what other appraoches can I use and then does the original share() affect when the subscribe reacts?
Shouldnt
from([])
only result in completion? Seems like it just freezes
yes should be same as EMPTY
merge(sub)
Notice
merge([sub])
.subscribe(
(e) => console.log('subscribe' + e),
() => {},
() => console.log('complete'));
will emit
subscribe[object Object]
complete
the [object Object]
here is the behaviorsubject.
merge(sub1, sub2)