title: rxjs conditional startWith
body: <p>So what I am trying to do here is to use startWith conditionally based on another observable.</p>
  
  <p>I tried mergeMap instead of map and wrapped the return values with 'of' but didn't work.</p>
  
  <pre><code>fromEvent(element.nativeElement,'click').pipe(
      withLatestFrom(this.isMobileView$),
      map(([event, isMobileView]) =&gt; {
          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),
  
  );
  </code></pre>
  
  <p>expecting the observable stream to start with false when mobile view and true otherwise.</p>