defaultIfEmpty
signature: defaultIfEmpty(defaultValue: any): Observable
defaultIfEmpty(defaultValue: any): Observable
Emit given value if nothing is emitted before completion.
Examples
Example 1: Default for empty value
( Stackblitz | jsBin | jsFiddle )
Example 2: Default for Observable.empty
( Stackblitz | jsBin | jsFiddle )
Additional Resources
:newspaper: - Official docs
:file_folder: Source Code: https://github.com/ReactiveX/rxjs/blob/master/src/internal/operators/defaultIfEmpty.ts
Last updated