ngx-scanner
ngx-scanner copied to clipboard
ExpressionChangedAfterItHasBeenCheckedError
Describe the bug When switching between cameras throws the error: ExpressionChangedAfterItHasBeenCheckedError. The error throws in the stackblitz example of yours too.
In that link: https://zxing-js.github.io/ngx-scanner/
To Reproduce Steps to reproduce the behavior:
- Open the console
- Select some other devices
- See error.
Expected behavior A clear and concise description of what you expected to happen. Change device without throws errors.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: [e.g. iOS]: Windows 10 PRO
- Browser [e.g. chrome, safari]: Chrome.
- Version [e.g. 22]: 79.0.3945.79
I removed that warning by adding a setTimeout to the reset method:
/**
* Resets the scanner and emits device change.
*/
ZXingScannerComponent.prototype.reset = function () {
this._reset();
setTimeout(() => {
this.deviceChange.emit(null);
})
};
ZXingScannerComponent.prototype.reset = function () { this._reset(); setTimeout(() => { this.deviceChange.emit(null); }) };
@rafaellyra, where do you put this code to get rid of that error?