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

Method ngAfterContentInit

src/material/radio/radio.ts:269–284  ·  view source on GitHub ↗

* Initialize properties once content children are available. * This allows us to propagate relevant attributes to associated buttons.

()

Source from the content-addressed store, hash-verified

267 * This allows us to propagate relevant attributes to associated buttons.
268 */
269 ngAfterContentInit() {
270 // Mark this component as initialized in AfterContentInit because the initial value can
271 // possibly be set by NgModel on MatRadioGroup, and it is possible that the OnInit of the
272 // NgModel occurs *after* the OnInit of the MatRadioGroup.
273 this._isInitialized = true;
274
275 // Clear the `selected` button when it's destroyed since the tabindex of the rest of the
276 // buttons depends on it. Note that we don't clear the `value`, because the radio button
277 // may be swapped out with a similar one and there are some internal apps that depend on
278 // that behavior.
279 this._buttonChanges = this._radios.changes.subscribe(() => {
280 if (this.selected && !this._radios.find(radio => radio === this.selected)) {
281 this._selected = null;
282 }
283 });
284 }
285
286 ngOnDestroy() {
287 this._buttonChanges?.unsubscribe();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected