@@ -24,7 +24,8 @@ import {
24
24
ChangeDetectorRef ,
25
25
Attribute ,
26
26
OnInit ,
27
- Inject
27
+ Inject ,
28
+ ChangeDetectionStrategy ,
28
29
} from '@angular/core' ;
29
30
import { MdOption , MdOptionSelectionChange , MdOptgroup } from '../core/option/index' ;
30
31
import { ENTER , SPACE , UP_ARROW , DOWN_ARROW , HOME , END } from '../core/keyboard/keycodes' ;
@@ -122,6 +123,7 @@ export const _MdSelectMixinBase = mixinColor(mixinDisabled(MdSelectBase), 'prima
122
123
styleUrls : [ 'select.css' ] ,
123
124
inputs : [ 'color' , 'disabled' ] ,
124
125
encapsulation : ViewEncapsulation . None ,
126
+ changeDetection : ChangeDetectionStrategy . OnPush ,
125
127
host : {
126
128
'role' : 'listbox' ,
127
129
'[attr.tabindex]' : 'tabIndex' ,
@@ -386,6 +388,7 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On
386
388
this . _calculateOverlayPosition ( ) ;
387
389
this . _placeholderState = this . _floatPlaceholderState ( ) ;
388
390
this . _panelOpen = true ;
391
+ this . _changeDetectorRef . markForCheck ( ) ;
389
392
}
390
393
391
394
/** Closes the overlay panel and focuses the host element. */
@@ -397,6 +400,7 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On
397
400
this . _placeholderState = '' ;
398
401
}
399
402
403
+ this . _changeDetectorRef . markForCheck ( ) ;
400
404
this . focus ( ) ;
401
405
}
402
406
}
@@ -443,6 +447,7 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On
443
447
*/
444
448
setDisabledState ( isDisabled : boolean ) : void {
445
449
this . disabled = isDisabled ;
450
+ this . _changeDetectorRef . markForCheck ( ) ;
446
451
}
447
452
448
453
/** Whether or not the overlay panel is open. */
@@ -482,6 +487,7 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On
482
487
*/
483
488
private _setTriggerWidth ( ) : void {
484
489
this . _triggerWidth = this . _getTriggerRect ( ) . width ;
490
+ this . _changeDetectorRef . markForCheck ( ) ;
485
491
}
486
492
487
493
/** Handles the keyboard interactions of a closed select. */
@@ -519,6 +525,7 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On
519
525
this . onClose . emit ( ) ;
520
526
this . _panelDoneAnimating = false ;
521
527
this . overlayDir . offsetX = 0 ;
528
+ this . _changeDetectorRef . markForCheck ( ) ;
522
529
}
523
530
}
524
531
@@ -528,6 +535,7 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On
528
535
*/
529
536
_onFadeInDone ( ) : void {
530
537
this . _panelDoneAnimating = this . panelOpen ;
538
+ this . _changeDetectorRef . markForCheck ( ) ;
531
539
}
532
540
533
541
/**
@@ -537,6 +545,7 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On
537
545
_onBlur ( ) {
538
546
if ( ! this . disabled && ! this . panelOpen ) {
539
547
this . _onTouched ( ) ;
548
+ this . _changeDetectorRef . markForCheck ( ) ;
540
549
}
541
550
}
542
551
@@ -741,7 +750,8 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On
741
750
* overflow. The selection arrow is 9px wide, add 4px of padding = 13
742
751
*/
743
752
private _setValueWidth ( ) {
744
- this . _selectedValueWidth = this . _triggerWidth - 13 ;
753
+ this . _selectedValueWidth = this . _triggerWidth - 13 ;
754
+ this . _changeDetectorRef . markForCheck ( ) ;
745
755
}
746
756
747
757
/**
@@ -838,8 +848,7 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On
838
848
* Determines the CSS `opacity` of the placeholder element.
839
849
*/
840
850
_getPlaceholderOpacity ( ) : string {
841
- return ( this . floatPlaceholder !== 'never' || this . _selectionModel . isEmpty ( ) ) ?
842
- '1' : '0' ;
851
+ return ( this . floatPlaceholder !== 'never' || this . _selectionModel . isEmpty ( ) ) ? '1' : '0' ;
843
852
}
844
853
845
854
/** Returns the aria-label of the select component. */
0 commit comments