У меня проблема с cordova-plugin-qrscanner в проекте Angular. В моем компоненте я сканирую QR-код, и если сканирование завершено, я хочу перейти к другому компоненту.
К сожалению, это не работает правильно. Это часть моего кода
scan() {
// QRScanner.prepare();
const that = this;
QRScanner.show();
window.document.querySelector('body').classList.remove('transparentBody');
QRScanner.scan(displayContents);
function displayContents(err, text) {
if(err){
console.log('error', err);
// an error occurred, or the scan was canceled (error code `6`)
} else {
// The scan completed, display the contents of the QR code:
alert(text);
this._router.navigate(['/main/depositor']); // here dosen't work
if (text) {`enter code here`
QRScanner.destroy((status) => {
console.log('destroy scanner', status);
window.document.querySelector('body').classList.add('transparentBody');
this._router.navigate(['/main/depositor']); // here too dosen't work
});
}
}
}
}
У кого-нибудь есть подобная проблема? На моем телефоне выход из приложения после навигации или ничего не делать. Понятия не имею, что не так