diff --git a/src/cdk/a11y/focus-trap.ts b/src/cdk/a11y/focus-trap.ts index cb09557accba..d726b8309560 100644 --- a/src/cdk/a11y/focus-trap.ts +++ b/src/cdk/a11y/focus-trap.ts @@ -265,7 +265,7 @@ export class FocusTrap { if (this._ngZone.isStable) { fn(); } else { - first.call(this._ngZone.onStable).subscribe(fn); + first.call(this._ngZone.onStable.asObservable()).subscribe(fn); } } } diff --git a/src/lib/autocomplete/autocomplete-trigger.ts b/src/lib/autocomplete/autocomplete-trigger.ts index bbc97e958339..7d3aca8621fa 100644 --- a/src/lib/autocomplete/autocomplete-trigger.ts +++ b/src/lib/autocomplete/autocomplete-trigger.ts @@ -372,7 +372,7 @@ export class MdAutocompleteTrigger implements ControlValueAccessor, OnDestroy { * stream every time the option list changes. */ private _subscribeToClosingActions(): Subscription { - const firstStable = first.call(this._zone.onStable); + const firstStable = first.call(this._zone.onStable.asObservable()); const optionChanges = map.call(this.autocomplete.options.changes, () => this._positionStrategy.recalculateLastPosition()); diff --git a/src/lib/datepicker/calendar.ts b/src/lib/datepicker/calendar.ts index af1e203c7838..a434e9c0b52d 100644 --- a/src/lib/datepicker/calendar.ts +++ b/src/lib/datepicker/calendar.ts @@ -218,9 +218,11 @@ export class MdCalendar implements AfterContentInit, OnDestroy { /** Focuses the active cell after the microtask queue is empty. */ _focusActiveCell() { - this._ngZone.runOutsideAngular(() => first.call(this._ngZone.onStable).subscribe(() => { - this._elementRef.nativeElement.querySelector('.mat-calendar-body-active').focus(); - })); + this._ngZone.runOutsideAngular(() => { + first.call(this._ngZone.onStable.asObservable()).subscribe(() => { + this._elementRef.nativeElement.querySelector('.mat-calendar-body-active').focus(); + }); + }); } /** Whether the two dates represent the same view in the current view mode (month or year). */ diff --git a/src/lib/datepicker/datepicker.ts b/src/lib/datepicker/datepicker.ts index 7f8ed7d49bf6..65ccc5349ee4 100644 --- a/src/lib/datepicker/datepicker.ts +++ b/src/lib/datepicker/datepicker.ts @@ -313,7 +313,9 @@ export class MdDatepicker implements OnDestroy { componentRef.instance.datepicker = this; // Update the position once the calendar has rendered. - first.call(this._ngZone.onStable).subscribe(() => this._popupRef.updatePosition()); + first.call(this._ngZone.onStable.asObservable()).subscribe(() => { + this._popupRef.updatePosition(); + }); } this._popupRef.backdropClick().subscribe(() => this.close()); diff --git a/src/lib/sidenav/drawer.ts b/src/lib/sidenav/drawer.ts index 4a00b86a035f..48ff5306c5a5 100644 --- a/src/lib/sidenav/drawer.ts +++ b/src/lib/sidenav/drawer.ts @@ -401,8 +401,11 @@ export class MdDrawerContainer implements AfterContentInit { } // NOTE: We need to wait for the microtask queue to be empty before validating, // since both drawers may be swapping positions at the same time. - takeUntil.call(drawer.onPositionChanged, this._drawers.changes).subscribe(() => - first.call(this._ngZone.onMicrotaskEmpty).subscribe(() => this._validateDrawers())); + takeUntil.call(drawer.onPositionChanged, this._drawers.changes).subscribe(() => { + first.call(this._ngZone.onMicrotaskEmpty.asObservable()).subscribe(() => { + this._validateDrawers(); + }); + }); } /** Toggles the 'mat-drawer-opened' class on the main 'md-drawer-container' element. */ diff --git a/src/lib/snack-bar/snack-bar-container.ts b/src/lib/snack-bar/snack-bar-container.ts index e0acfc2b1766..dc1a14883ae6 100644 --- a/src/lib/snack-bar/snack-bar-container.ts +++ b/src/lib/snack-bar/snack-bar-container.ts @@ -165,11 +165,9 @@ export class MdSnackBarContainer extends BasePortalHost implements OnDestroy { private _completeExit() { // Note: we shouldn't use `this` inside the zone callback, // because it can cause a memory leak. - const onExit = this._onExit; - - first.call(this._ngZone.onMicrotaskEmpty).subscribe(() => { - onExit.next(); - onExit.complete(); + first.call(this._ngZone.onMicrotaskEmpty.asObservable()).subscribe(() => { + this._onExit.next(); + this._onExit.complete(); }); } } diff --git a/src/lib/tooltip/tooltip.ts b/src/lib/tooltip/tooltip.ts index 29a89a81c880..ae2486dca665 100644 --- a/src/lib/tooltip/tooltip.ts +++ b/src/lib/tooltip/tooltip.ts @@ -372,7 +372,7 @@ export class MdTooltip implements OnDestroy { this._tooltipInstance.message = message; this._tooltipInstance._markForCheck(); - first.call(this._ngZone.onMicrotaskEmpty).subscribe(() => { + first.call(this._ngZone.onMicrotaskEmpty.asObservable()).subscribe(() => { if (this._tooltipInstance) { this._overlayRef!.updatePosition(); }