Javascript 如何在Ionic 2中使用条形码扫描仪重定向到其他视图
扫描条形码时,我需要重定向到另一个视图,我正在使用离子2中的条形码扫描仪。我尝试了push方法,但它不起作用。如果不加载其他页面,我还尝试将参数传递给其他视图。我做错了什么 第一视图的方法:Javascript 如何在Ionic 2中使用条形码扫描仪重定向到其他视图,javascript,angularjs,typescript,ionic2,barcode-scanner,Javascript,Angularjs,Typescript,Ionic2,Barcode Scanner,扫描条形码时,我需要重定向到另一个视图,我正在使用离子2中的条形码扫描仪。我尝试了push方法,但它不起作用。如果不加载其他页面,我还尝试将参数传递给其他视图。我做错了什么 第一视图的方法: 异步扫描条形码(){ 此选项={ 提示:“Escanea un codigo de barra…” } this.results=等待this.barcode.scan(this.options); this.navCtrl.push(Infoproducto,{//此命令不起作用 resultados:
异步扫描条形码(){
此选项={
提示:“Escanea un codigo de barra…”
}
this.results=等待this.barcode.scan(this.options);
this.navCtrl.push(Infoproducto,{//此命令不起作用
resultados:this.results
});
//console.log(this.results);
}
它应该是这样工作的:
this.barcodeScanner.scan().then((barcodeData) => {
this.navCtrl.push(SomePage, {data: barcodeDate});
}, (error) => {
// handle error
});
我在过去成功地使用过类似的方法。它应该是这样工作的:
this.barcodeScanner.scan().then((barcodeData) => {
this.navCtrl.push(SomePage, {data: barcodeDate});
}, (error) => {
// handle error
});
我在过去成功地使用过类似的方法