So what I am trying to do here is to use startWith conditionally based on another observable.
I tried mergeMap instead of map and wrapped the return values with 'of' but didn't work.
fromEvent(element.nativeElement,'click').pipe(
withLatestFrom(this.isMobileView$),
map(([event, isMobileView]) => {
if (isMobileView) {
// do some stuff
return false;
} else {
// do some other stuff
// return a boolean variable
return this._drawer.opened;
}// TODO: else if nativescript
}),
//here I want to use 'isMobileView' inside my startWith
// something like startWith(!isMobileView)
startWith(true),
);
expecting the observable stream to start with false when mobile view and true otherwise.
this.isMobileView$
a behavior subject? – bryan60