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

Method ngOnInit

src/material/button-toggle/button-toggle.ts:692–707  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

690 }
691
692 ngOnInit() {
693 const group = this.buttonToggleGroup;
694 this.id = this.id || this._idGenerator.getId('mat-button-toggle-');
695
696 if (group) {
697 if (group._isPrechecked(this)) {
698 this.checked = true;
699 } else if (group._isSelected(this) !== this._checked) {
700 // As side effect of the circular dependency between the toggle group and the button,
701 // we may end up in a state where the button is supposed to be checked on init, but it
702 // isn't, because the checked value was assigned too early. This can happen when Ivy
703 // assigns the static input value before the `ngOnInit` has run.
704 group._syncButtonToggle(this, this._checked);
705 }
706 }
707 }
708
709 ngAfterViewInit() {
710 // This serves two purposes:

Callers

nothing calls this directly

Calls 4

_isPrecheckedMethod · 0.80
_syncButtonToggleMethod · 0.80
getIdMethod · 0.45
_isSelectedMethod · 0.45

Tested by

no test coverage detected