title: How to dispatch multiple actions from an effect in ngrx conditionally
body: <p>I am a back-end developer starting with front-end development for a project I am working on. The front-end uses Angular7 and NgRx. I have studied a lot in the last 4 days, but here is something I am stuck with and would appreciate your help.</p>
  
  <p>I learnt that we can dispatch multiple actions from an effect in NgRx by returning an Observable array having multiple actions. I want to dispatch one of the action in the array based on a condition.</p>
  
  <p>My code looks something like this </p>
  
  <pre><code>@Effect()
    something$: Observable&lt;Action&gt; = this.actions$.pipe(
      ofType(ActionType),
      switchMap.(action: any) =&gt; {
         return service.call(action.payload)
           .pipe(
               switchMap((data: ReturnType) =&gt; [ 
                  new Action1(),
                  new Action2(),
                ]),
          catchError(error handling)
        );
      }),
     );
  </code></pre>
  
  <p>and I want to achieve something like this</p>
  
  <pre><code>   @Effect()
    something$: Observable&lt;Action&gt; = this.actions$.pipe(
      ofType(ActionType),
      switchMap.(action: any) =&gt; {
         return service.call(action.payload)
           .pipe(
               switchMap((data: ReturnType) =&gt; [ 
                   if(condition)
                     new Action1()
                    else
                      new Action1.1() ,
                  new Action2(),
                ]),
          catchError(error handling)
        );
      }),
     );
  </code></pre>
  
  <p>I think its my lack of knowledge of RxJs, which is preventing me to implement the condition.</p>