```
$scope.scanBarcode = function(){

$cordovaBarcodeScanner.scan().then(function(imageData){

  alert(imageData.text);

  console.log("Barcode format ->" + imageData.format);

  console.log("Cancelled ->" + imageData.cancelled);

  },
 function(error) {

  console.log("An error happened ->" + error);
 });

 };

```

these are the errors in console

> 
> Error: [$injector:unpr] Unknown provider:
>  $cordovaBarcodeScannerProvider <- $cordovaBarcodeScanner <- AppCtrl
>  <http://errors.angularjs.org/1.3.13/>$injector/unpr?p0=%24cordovaBarcodeScannerProvider%20%3C-%20%24cordovaBarcodeScanner%20%3C-%20AppCtrl
>  at REGEX\_STRING\_REGEXP (ionic.bundle.js:8762)
>  at ionic.bundle.js:12696
>  at Object.getService [as get] (ionic.bundle.js:12843)
>  at ionic.bundle.js:12701
>  at getService (ionic.bundle.js:12843)
>  at invoke (ionic.bundle.js:12875)
>  at Object.instantiate (ionic.bundle.js:12892)
>  at ionic.bundle.js:17161
>  at IonicModule.controller.self.appendViewElement (ionic.bundle.js:48253)
>  at Object.IonicModule.factory.ionicViewSwitcher.create.switcher.render
>  (ionic.bundle.js:46450)(anonymous function) @
>  ionic.bundle.js:20306$get @ ionic.bundle.js:17256$get.Scope.$broadcast
>  @
>  ionic.bundle.js:23421$state.transitionTo.$state.transition.resolved.then.$state.transition
>  @ ionic.bundle.js:40889processQueue @ ionic.bundle.js:21888(anonymous
>  function) @ ionic.bundle.js:21904$get.Scope.$eval @
>  ionic.bundle.js:23100$get.Scope.$digest @
>  ionic.bundle.js:22916$get.Scope.$apply @ ionic.bundle.js:23205done @
>  ionic.bundle.js:18358completeRequest @
>  ionic.bundle.js:18548requestLoaded @
>  ionic.bundle.js:18489XMLHttpRequest.send (async)(anonymous function) @
>  ionic.bundle.js:18526sendReq @ ionic.bundle.js:18327$get.serverRequest
>  @ ionic.bundle.js:18043processQueue @ ionic.bundle.js:21888(anonymous
>  function) @ ionic.bundle.js:21904$get.Scope.$eval @
>  ionic.bundle.js:23100$get.Scope.$digest @
>  ionic.bundle.js:22916$get.Scope.$apply @
>  ionic.bundle.js:23205bootstrapApply @ ionic.bundle.js:10147invoke @
>  ionic.bundle.js:12884doBootstrap @ ionic.bundle.js:10145bootstrap @
>  ionic.bundle.js:10165angularInit @ ionic.bundle.js:10059(anonymous
>  function) @ ionic.bundle.js:34824trigger @
>  ionic.bundle.js:11443eventHandler @ ionic.bundle.js:11713
> 
> 
>