IonicngCordovaプラグイン-QRコードスキャン



Ionic Ngcordova Plug Qr Code Scanning



統合されたQRコードスキャンプラグイン

あなたはそうするようにngCordovaをインストールするためにbowerを使うことができます または ここからzipファイルをダウンロードします 、distフォルダーで.jsファイルを見つけます。

$ bower install ngCordova

ng-cordova.jsが含まれています または index.htmlファイル内のng-cordova.min.js cordova.jsと AngularJS / Ionicファイル(ngCordovaはAngularJSに依存しているため)。



angular.module('myApp', ['ngCordova'])

Angular依存性として注入
次に、Angularモジュールの依存関係としてngCordovaを含めます。

- Install the plugin: `$cordovaBarcodeScanner` [official link] (http://ngcordova.com/docs/plugins/barcodeScanner/) cordova plugin add https://github.com/phonegap/phonegap-plugin-barcodescanner.git - Called in the controller angular.module('barcodescanner', []) .controller('BarcodeScannerCtrl', function($scope,$state,$cordovaBarcodeScanner,MyAppUtils){ $scope.openScanCamara = function(){ $cordovaBarcodeScanner.scan() .then(function(barcodeData) { // Success! Barcode data is here MyAppUtils.showCustomAlert(barcodeData.text) }, function(error) { // An error occurred MyAppUtils.showCustomAlert(error) }) } })
|_+_|

詳細な使用法については、プラグインのGitHubアドレスを参照してください。

QRコードスキャンの問題の概要と解決策

  • クリックしてスキャンしますが、カメラのインターフェースに直接詰まっていることがありますか?
    Ctrlキーを押しながらクリックしてスキャンボタンを開きます。コンボを押さないでください。 2回調整すると動かなくなります。
  • 同じQRコードで、Androidスマートフォンの認識は正常ですが、iOSはそれを認識できませんか?またはその逆? QRコードのもつれと認識が遅すぎますか?以下のQRコードスキャンプラグインを試すことをお勧めします csZBar