Ionic Barcode Scanner Not Return any Data


#1

I am trying to create a simple that will read the data from a qr code, the apps is working perfectly, it can open the camera and capture the image, the problem is, it cannot show the data/data is blank in the alert as below code.

this is how i do it

cordova plugin add https://github.com/wildabeast/BarcodeScanner.git

index.html

        <!DOCTYPE html>
        <html>
        <head>
            <meta charset="utf-8">
            <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
            <title></title>

            <link href="lib/ionic/css/ionic.css" rel="stylesheet">
            <link href="css/style.css" rel="stylesheet">

            <!-- ionic/angularjs js -->
            <script src="lib/ionic/js/ionic.bundle.js"></script>

            <!-- cordova script (this will be a 404 during development) -->
            <script src="lib/ng-cordova.min.js"></script>
            <script src="cordova.js"></script>

            <!-- your app's js -->
            <script src="js/app.js"></script>
            <script src="js/controllers.js"></script>
        </head>
        <body ng-app="starter">

            <ion-pane>
            <ion-header-bar class="bar-stable">
                <h1 class="title">Ionic Blank Starter</h1>
            </ion-header-bar>
            <ion-content>
                <div class="card">
                   <div class="item" ng-controller="ScanCtrl">
                       <button class="button button-block button-positive" ng-click="scanBarcode()">
                           <i class="icon ion-qr-scanner"></i>
                           Scan With Scope
                       </button>
                   </div>
                </div>
            </ion-content>
            </ion-pane>
        </body>
        </html>

app.js

        angular.module('starter', ['ionic', 'starter.controllers', 'ngCordova'])
        .run(function($ionicPlatform) {
          $ionicPlatform.ready(function() {
            if(window.cordova && window.cordova.plugins.Keyboard) {
              // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
              // for form inputs)
              cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);

              // Don't remove this line unless you know what you are doing. It stops the viewport
              // from snapping when text inputs are focused. Ionic handles this internally for
              // a much nicer keyboard experience.
              cordova.plugins.Keyboard.disableScroll(true);
            }
            if(window.StatusBar) {
               StatusBar.styleDefault();
            }
          });
        })

controllers.js

    angular.module('starter.controllers', [])

    .controller('ScanCtrl', function($scope, $cordovaBarcodeScanner){
     $scope.scanBarcode = function(){
        $cordovaBarcodeScanner.scan().then(function(imgData){
          alert(imgData.text);
        },function(error){
          alert("Error");
        }
        );
      }
    });

Any helps would really appreciated.