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

Method constructor

src/material/form-field/form-field.ts:350–369  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

348 protected readonly _animationsDisabled = _animationsDisabled();
349
350 constructor() {
351 const defaults = this._defaults;
352 const dir = inject(Directionality);
353
354 if (defaults) {
355 if (defaults.appearance) {
356 this.appearance = defaults.appearance;
357 }
358 this._hideRequiredMarker = Boolean(defaults?.hideRequiredMarker);
359 if (defaults.color) {
360 this.color = defaults.color;
361 }
362 }
363
364 // We need this value inside a `afterRenderEffect`, however at the time of writing, reading the
365 // signal directly causes a memory leak (see https://github.com/angular/angular/issues/62980).
366 // TODO(crisbeto): clean this up once the framework issue is resolved.
367 effect(() => (this._currentDirection = dir.valueSignal()));
368 this._syncOutlineLabelOffset();
369 }
370
371 ngAfterViewInit() {
372 // Initial focus state sync. This happens rarely, but we want to account for

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected