angularjs - Barcode Scanner using Ionic/ngcordova, redirect to view -


i put little thread on stack. after scanning need redirect view find below controller code.

i unable make part work:

$state.go('resultscan',{id:barcodedata.text});     

code:

starter.controller('homectrl',['$scope','$cordovabarcodescanner','$ionicplatform',  function($scope,$cordovabarcodescanner,$ionicplatform,$state) {    $scope.scan = function(){      //alert('nikoooo');      $ionicplatform.ready(function() {            $cordovabarcodescanner.scan().then(function(barcodedata,$state) {             //alert('accueil/'+json.stringify(barcodedata));             $state.go('resultscan',{id:barcodedata.text});            //barcodedata["text"]          }, function(error) {            alert(json.stringify(error));         });      });    } }]); 

the error telling doesn't know $state is, or it's undefined. try adding controller:

starter.controller('homectrl',['$scope','$cordovabarcodescanner','$ionicplatform', '$state', function($scope,$cordovabarcodescanner,$ionicplatform,$state) { 

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -