MCPcopy Create free account
hub / github.com/angular/components / _animateAndLockLabel

Method _animateAndLockLabel

src/material/form-field/form-field.ts:455–467  ·  view source on GitHub ↗

Animates the placeholder up and locks it in position.

()

Source from the content-addressed store, hash-verified

453
454 /** Animates the placeholder up and locks it in position. */
455 _animateAndLockLabel(): void {
456 // This is for backwards compatibility only. Consumers of the form field might use
457 // this method. e.g. the autocomplete trigger. This method has been added to the non-MDC
458 // form field because setting "floatLabel" to "always" caused the label to float without
459 // animation. This is different in MDC where the label always animates, so this method
460 // is no longer necessary. There doesn't seem any benefit in adding logic to allow changing
461 // the floating label state without animations. The non-MDC implementation was inconsistent
462 // because it always animates if "floatLabel" is set away from "always".
463 // TODO(devversion): consider removing this method when releasing the MDC form field.
464 if (this._hasFloatingLabel()) {
465 this.floatLabel = 'always';
466 }
467 }
468
469 /** Initializes the registered form field control. */
470 private _initializeControl(previousControl: MatFormFieldControl<unknown> | null) {

Callers 1

_floatLabelMethod · 0.80

Calls 1

_hasFloatingLabelMethod · 0.80

Tested by

no test coverage detected