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

Method ngAfterViewInit

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

Source from the content-addressed store, hash-verified

362 }
363
364 ngAfterViewInit() {
365 // Initial focus state sync. This happens rarely, but we want to account for
366 // it in case the form field control has "focused" set to true on init.
367 this._updateFocusState();
368
369 if (!this._animationsDisabled) {
370 this._ngZone.runOutsideAngular(() => {
371 // Enable animations after a certain amount of time so that they don't run on init.
372 setTimeout(() => {
373 this._elementRef.nativeElement.classList.add('mat-form-field-animations-enabled');
374 }, 300);
375 });
376 }
377
378 // Because the above changes a value used in the template after it was checked, we need
379 // to trigger CD or the change might not be reflected if there is no other CD scheduled.
380 this._changeDetectorRef.detectChanges();
381 }
382
383 ngAfterContentInit() {
384 this._assertFormFieldControl();

Callers

nothing calls this directly

Calls 2

_updateFocusStateMethod · 0.95
addMethod · 0.45

Tested by

no test coverage detected