diff --git a/src/lib/select/select.ts b/src/lib/select/select.ts index 910aa7f8a90c..14dd4018659f 100644 --- a/src/lib/select/select.ts +++ b/src/lib/select/select.ts @@ -20,6 +20,7 @@ import { Inject, InjectionToken, Input, + NgZone, OnDestroy, OnInit, Optional, @@ -35,7 +36,7 @@ import {DOWN_ARROW, END, ENTER, HOME, SPACE, UP_ARROW} from '@angular/cdk/keycod import {FocusKeyManager} from '@angular/cdk/a11y'; import {Directionality} from '@angular/cdk/bidi'; import {coerceBooleanProperty} from '@angular/cdk/coercion'; -import {filter, startWith} from '@angular/cdk/rxjs'; +import {filter, first, startWith} from '@angular/cdk/rxjs'; import { ConnectedOverlayDirective, Overlay, @@ -281,7 +282,6 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On /** * Stream that emits whenever the state of the select changes such that the wrapping `MdFormField` * needs to run change detection. - * TODO(mmalerba): Call emit at appropriate times. */ stateChanges = new Subject(); @@ -405,6 +405,7 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On private _viewportRuler: ViewportRuler, private _changeDetectorRef: ChangeDetectorRef, private _platform: Platform, + private _ngZone: NgZone, renderer: Renderer2, elementRef: ElementRef, @Optional() private _dir: Directionality, @@ -475,6 +476,13 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On this._calculateOverlayPosition(); this._panelOpen = true; this._changeDetectorRef.markForCheck(); + + // Set the font size on the panel element once it exists. + first.call(this._ngZone.onStable).subscribe(() => { + if (this._triggerFontSize && this.overlayDir.overlayRef.overlayElement) { + this.overlayDir.overlayRef.overlayElement.style.fontSize = `${this._triggerFontSize}px`; + } + }); } /** Closes the overlay panel and focuses the host element. */