yangzonglong 发表于 2016-7-20 17:24:44

.controller('HomeCtrl', function($scope, $cordovaBarcodeScanner) {
$scope.scanBarcode = function() {
    $cordovaBarcodeScanner.scan().then(function(result) {

      // alert("We got a barcode\n" +
      //   "Result: " + result.text + "\n" +
      //   "Format: " + result.format + "\n" +
      //   "Cancelled: " + result.cancelled);
    }, function(error) {
      alert("An error happened -> " + error);
    });
}
})

yangzonglong 发表于 2016-7-20 17:25:06

我这样写的 没问题

FallenLeaves 发表于 2017-11-22 09:49:12

你好,为什么我测试就没有用呢,点击扫描按钮都没效果,是我的sdk没有最新版本的问题么?

缘来了 发表于 2018-1-28 12:43:47



这个教程里面有讲扫描二维码的亲们
https://www.itying.com/goods-460.html
1. Ionic3、Ionic4.x、Cordova 调用原生硬件Api 扫描二维码 条形码 -ZBar

2 Ionic3、Ionic4.x、Cordova 调用原生硬件Api 扫描二维码 条形码-Barcode Scanner




zhuyongqin2 发表于 2018-2-2 09:43:44

FallenLeaves 发表于 2017-11-22 09:49
你好,为什么我测试就没有用呢,点击扫描按钮都没效果,是我的sdk没有最新版本的问题么? ...

我也是这样写的,点击按钮没有任何效果。不知道为什么
页: 1 [2]
查看完整版本: Ionic 用ngCordova添加扫码插件遇到的问题,请大神求解