Hi,
I need to embed camera view of a barcode scanner to one of the Ionic screens (.html pages).
For that I found the Ionic recommended plugin but I prefered this : https://github.com/tjwoon/csZBar
since it seems possible to do the customization I need. But unfortunately When I integrate the plugin and run before doing any customization it didn’t show up the camera view.
When I click scan button it invokes the scan() but nothing else happens. no errors either. It seems the onSuccess is never get called.
Please find the simple code I wrote. It’s in typescript. Plugin is written using javascript. Would that make an issue. What would I have done wrong?
import {Component, ViewChild} from '@angular/core';
import {Nav, NavController,Platform, AlertController} from 'ionic-angular';
@Component({
templateUrl: 'build/pages/home/home.html'
})
export class HomePage {
@ViewChild(Nav) nav: Nav;
cordova:any;
constructor(public navCtrl: NavController, public platform: Platform) {
}
scan() {
this.platform.ready().then(() => {
this.cordova.plugins.cloudSky.zBar.scan({camera: "back", drawSight: true}, this.onSuccess, this.onFailure);
}, (error) => {
});
}
onSuccess(code: String){
alert("scanned result: " + code);
}
onFailure(e : String){
alert("scanned result: " + e);
}
}
Regards,
Madusha