MCPcopy
hub / github.com/angular/components / ngAfterViewInit

Method ngAfterViewInit

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

_updateFocusStateMethod · 0.95
addMethod · 0.45

Tested by

no test coverage detected