Skip to content

Commit f3c1ef2

Browse files
committed
fix(buttonGroup): Resolve buttons not selected if initialized after the group
1 parent 365bfa6 commit f3c1ef2

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

projects/igniteui-angular/src/lib/buttonGroup/buttonGroup.component.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -462,14 +462,19 @@ export class IgxButtonGroupComponent extends DisplayDensityBase implements After
462462
});
463463
};
464464

465-
this.viewButtons.changes.pipe(takeUntil(this.queryListNotifier$)).subscribe(() => initButtons());
466-
this.templateButtons.changes.pipe(takeUntil(this.queryListNotifier$)).subscribe(() => initButtons());
467-
initButtons();
468-
469-
this._cdr.detectChanges();
470-
471465
this.mutationObserver = this.setMutationsObserver();
472466

467+
this.viewButtons.changes.pipe(takeUntil(this.queryListNotifier$)).subscribe(() => {
468+
this.mutationObserver.disconnect();
469+
initButtons();
470+
});
471+
this.templateButtons.changes.pipe(takeUntil(this.queryListNotifier$)).subscribe(() => {
472+
this.mutationObserver.disconnect();
473+
initButtons();
474+
});
475+
476+
initButtons();
477+
this._cdr.detectChanges();
473478
this.mutationObserver?.observe(this._el.nativeElement, this.observerConfig);
474479
}
475480

0 commit comments

Comments
 (0)