function stable

Converts an Observable of Notification objects into the emissions that they represent.

dematerialize<T>(): OperatorFunction<Notification<T>, T>


There are no parameters.


OperatorFunction<Notification<T>, T>: An Observable that emits items and notifications embedded in Notification objects emitted by the source Observable.


Unwraps Notification objects as actual next, error and complete emissions. The opposite of materialize.

dematerialize marble diagram

dematerialize is assumed to operate an Observable that only emits Notification objects as next emissions, and does not emit any error. Such Observable is the output of a materialize operation. Those notifications are then unwrapped using the metadata they contain, and emitted as next, error, and complete on the output Observable.

Use this operator in conjunction with materialize.


Convert an Observable of Notifications to an actual Observable

import { of, Notification } from 'rxjs';
import { dematerialize } from 'rxjs/operators';

const notifA = new Notification('N', 'A');
const notifB = new Notification('N', 'B');
const notifE = new Notification('E', undefined,
  new TypeError('x.toUpperCase is not a function')
const materialized = of(notifA, notifB, notifE);
const upperCase = materialized.pipe(dematerialize());
upperCase.subscribe(x => console.log(x), e => console.error(e));

// Results in:
// A
// B
// TypeError: x.toUpperCase is not a function

See Also

© 2015–2018 Google, Inc., Netflix, Inc., Microsoft Corp. and contributors.
Code licensed under an Apache-2.0 License. Documentation licensed under CC BY 4.0.