iif
signature: iif(condition: () => boolean, trueResult: SubscribableOrPromise = EMPTY, falseResult: SubscribableOrPromise = EMPTY): Observable
iif(condition: () => boolean, trueResult: SubscribableOrPromise = EMPTY, falseResult: SubscribableOrPromise = EMPTY): Observable
Subscribe to first or second observable based on a condition
Examples
Example 1: simple iif
( Stackblitz )
Example 2: iif with mouse moves
( Stackblitz )
Example 3: iif with default
( Stackblitz )
Related Recipes
Additional Resources
iif :newspaper: -
Official docs
:file_folder: Source Code: https://github.com/ReactiveX/rxjs/blob/master/src/internal/observable/iif.ts
Last updated