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

Method ngAfterViewInit

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

_updateFocusStateMethod · 0.95
addMethod · 0.45

Tested by

no test coverage detected