Ion-content wont show - barcode scanning

I’m a novice programming and having a hard time figuring out why the content wont show in the app.

APP ID: 3c59c670

I added ng-cordova.js to my index.html then added it to app.js :

 angular.module('starter', ['ionic', 'starter.controllers', 'starter.services', 'ngCordova'])

I created a controller:

.controller('ScanController', function($scope, $cordovaBarcodeScanner) {

  $scope.scanBarcode = function() { 
    $cordovaBarcodeScanner.scan().then(function(imageData) {
      alert(imageData.text);
      console.log("format " + imageData.format);    
    }, function(error) {
      console.log("Scan error occured " + error);
    });
    
  }

})

Then I created the content html page:

<ion-view view-title="Service Visit">
  <ion-content ng-controller="ScanController">
  <button class="button" ng-click="scanBarcode()">Scan</button>  
  </ion-content>
</ion-view>

More basic information is needed:

Which platform(s) are you having trouble on?

Are you running this with ionic serve, ionic run, or ionic run -l?

More specific to your issue:

Do other buttons work in the same view/controller - such as a button calling a function that just writes to the console?

Are either of your console.log(...) lines being called?

thanks for the quick reply.

I’m running this on Android.

I use

ionic build android

then

ionic upload

and use the app through ionic view app

Hmm, I’ve never used the Ionic View app. Are you able to read the console.log(...) outputs with it?

Did you add the plugin to the project with

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

Can you try hooking up the device to the computer and running it with ionic run android?

I’ve solved this with a different solution.

Thanks for your help!