fix(form-field): don't set up mutation observer on non-outline appearances (#12976)

Currently we use a `MutationObserver` to update the label gap when the label content changes. This is unnecessary on any appearance aside from `outline`.
This commit is contained in:
Kristiyan Kostadinov
2018-09-11 19:42:59 +02:00
committed by Jeremy Elbourn
parent 62136c16c4
commit cbfbaded96
2 changed files with 2 additions and 5 deletions
+1 -5
View File
@@ -145,11 +145,7 @@ export class CdkObserveContent implements AfterContentInit, OnDestroy {
get disabled() { return this._disabled; }
set disabled(value: any) {
this._disabled = coerceBooleanProperty(value);
if (this._disabled) {
this._unsubscribe();
} else {
this._subscribe();
}
this._disabled ? this._unsubscribe() : this._subscribe();
}
private _disabled = false;
+1
View File
@@ -28,6 +28,7 @@
read if it comes before the control in the DOM. -->
<label class="mat-form-field-label"
(cdkObserveContent)="updateOutlineGap()"
[cdkObserveContentDisabled]="appearance != 'outline'"
[id]="_labelId"
[attr.for]="_control.id"
[attr.aria-owns]="_control.id"