我是离子2的新手,我使用的是Typescript。我需要使用这个pugin https://github.com/tjwoon/csZBar。当我按照ionic2(https://ionicframework.com/docs/v2/native/zbar/)中的步骤进行操作时,
import { ZBar } from 'ionic-native';

,但Zbar未发现离子原生态; 我尝试了很多方法来使用typescript.just的ionic2中的插件,如:
declare var navigator : any;
@Component({
templateUrl: 'build/pages/special/main/more/more.html',
providers: [Router, UserService,Navbar]
})
export class MorePage {
constructor(private nav: NavController, private alertCtrl: AlertController, private router: Router) {
}
scanZBar() {
navigator.zBar.scan({camera: "back", drawSight: true}, data=> {
this.showAlert("warning", data);
}, data=> {
this.showAlert("warning", data);
});
}
}

scanZBar(){
(<any>window).plugins.zBar.scan({camera: "back", drawSight: true}, data=>{
this.showAlert("warning",data);
}, data=>{
this.showAlert("warning",data);
});
}