@@ -23,7 +23,6 @@ import {
23
23
} from '../core' ;
24
24
import { ControlValueAccessor , NG_VALUE_ACCESSOR } from '@angular/forms' ;
25
25
import { Observable } from 'rxjs/Observable' ;
26
- import { Subscription } from 'rxjs/Subscription' ;
27
26
28
27
export const MD_SLIDE_TOGGLE_VALUE_ACCESSOR : any = {
29
28
provide : NG_VALUE_ACCESSOR ,
@@ -77,9 +76,6 @@ export class MdSlideToggle implements OnDestroy, AfterContentInit, ControlValueA
77
76
/** Reference to the focus state ripple. */
78
77
private _focusRipple : RippleRef ;
79
78
80
- /** Subscription to focus-origin changes. */
81
- private _focusOriginSubscription : Subscription ;
82
-
83
79
/** Name value will be applied to the input element if present */
84
80
@Input ( ) name : string = null ;
85
81
@@ -133,18 +129,13 @@ export class MdSlideToggle implements OnDestroy, AfterContentInit, ControlValueA
133
129
ngAfterContentInit ( ) {
134
130
this . _slideRenderer = new SlideToggleRenderer ( this . _elementRef ) ;
135
131
136
- this . _focusOriginSubscription = this . _focusOriginMonitor
132
+ this . _focusOriginMonitor
137
133
. monitor ( this . _inputElement . nativeElement , this . _renderer , false )
138
134
. subscribe ( focusOrigin => this . _onInputFocusChange ( focusOrigin ) ) ;
139
135
}
140
136
141
137
ngOnDestroy ( ) {
142
- this . _focusOriginMonitor . unmonitor ( this . _inputElement . nativeElement ) ;
143
-
144
- if ( this . _focusOriginSubscription ) {
145
- this . _focusOriginSubscription . unsubscribe ( ) ;
146
- this . _focusOriginSubscription = null ;
147
- }
138
+ this . _focusOriginMonitor . stopMonitoring ( this . _inputElement . nativeElement ) ;
148
139
}
149
140
150
141
/**
0 commit comments