####signature: defaultIfEmpty(defaultValue: any): Observable
The deafultIfEmpty will mirror the output emitted by the source observable. If the source observable completes without emitting a value, the operator will emit the default value provided in the parameter (null is emitted if there is no parameter).
const empty = Rx.Observable.of();
//emit 'Observable.of() Empty!' when empty, else any values from source
const exampleOne = empty.defaultIfEmpty('Observable.of() Empty!');
//output: 'Observable.of() Empty!'
const subscribe = exampleOne.subscribe(val => console.log(val));//empty observable
const empty = Rx.Observable.empty();
//emit 'Observable.empty()!' when empty, else any values from source
const example = empty.defaultIfEmpty('Observable.empty()!');
//output: 'Observable.empty()!'
const subscribe = example.subscribe(val => console.log(val));- defaultIfEmpty 📰 - Official docs
📁 Source Code: https://github.com/ReactiveX/rxjs/blob/master/src/operator/defaultIfEmpty.ts