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

Method ngAfterViewChecked

src/material/core/option/option.ts:264–281  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

262 }
263
264 ngAfterViewChecked() {
265 // Since parent components could be using the option's label to display the selected values
266 // (e.g. `mat-select`) and they don't have a way of knowing if the option's label has changed
267 // we have to check for changes in the DOM ourselves and dispatch an event. These checks are
268 // relatively cheap, however we still limit them only to selected options in order to avoid
269 // hitting the DOM too often.
270 if (this._selected) {
271 const viewValue = this.viewValue;
272
273 if (viewValue !== this._mostRecentViewValue) {
274 if (this._mostRecentViewValue) {
275 this._stateChanges.next();
276 }
277
278 this._mostRecentViewValue = viewValue;
279 }
280 }
281 }
282
283 ngOnDestroy() {
284 this._stateChanges.complete();

Callers

nothing calls this directly

Calls 1

nextMethod · 0.45

Tested by

no test coverage detected