Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'ngClass: bootstrap-switch bootstrap-switch-wrapper bootstrap-switch-small bootstrap-switch-off bootstrap-switch-disabled bootstrap-switch-indeterminate'. Current value: 'ngClass: bootstrap-switch bootstrap-switch-wrapper bootstrap-switch-focused bootstrap-switch-small bootstrap-switch-off bootstrap-switch-disabled bootstrap-switch-indeterminate'.
Desired functionality.
The problem occurs when the bSwitch is used inside an NgbModal.
By design, the ngbModal tries to set focus to the first not disabled input available.
When we use a disabled bSwitch it gets focused by the modal, thus the error in console.
When the bSwitch is disabled it shouldn't get focused.
Bug Report or Feature Request (mark with an
x
)Versions.
Angular: 8.24 bSwitch: 2.0.5
Repro steps.
https://stackblitz.com/edit/angular-ybggsn?embed=1&file=app/modal-component.ts
The log given by the failure.
Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'ngClass: bootstrap-switch bootstrap-switch-wrapper bootstrap-switch-small bootstrap-switch-off bootstrap-switch-disabled bootstrap-switch-indeterminate'. Current value: 'ngClass: bootstrap-switch bootstrap-switch-wrapper bootstrap-switch-focused bootstrap-switch-small bootstrap-switch-off bootstrap-switch-disabled bootstrap-switch-indeterminate'.
Desired functionality.
The problem occurs when the bSwitch is used inside an NgbModal. By design, the ngbModal tries to set focus to the first not disabled input available. When we use a disabled bSwitch it gets focused by the modal, thus the error in console.
When the bSwitch is disabled it shouldn't get focused.
Mention any other details that might be useful.