Awesome Open Source
Awesome Open Source

angular-bar-code-scanner

Provide tool to detect bar code scan and pick back the value of the bar code


Installation

You can clone this project or directly use bower:

bower install --save angular-bar-code-scanner


Basic Usage

In order to use the bar code scan, you will need to include the lib:
// In your app.js
angular.module('myApp', ['angular-bar-code-scanner']);

Then include the directive "barCodeScanner" in your template on element (we don't really care about the type of element):


    <body data-bar-code-scanner>
        ...
    </body>
    

Now your application is able to detect scan. Just catch the scan event by listen the event:


angular.module('myApp').controller('MyController', function($scope){
    $scope.$on('bar-code-scan-event',function(event, parameters){
        console.info('Scan detected, bar code is : ' , parameters.barCodeValue);
    }
});

Configuration

You can configure two type of things:

  • The event name broadcast by directive
  • The number of char we use to consider that its a scan

Example :

``` angular.module('myApp').config(function(BarCodeScannerConfigProvider) { // Now you will need to listen event 'scan' BarCodeScannerConfigProvider.setBroadcastEventName('scan'); // Now you consider that bar code are make of 20 numerical char BarCodeScannerConfigProvider.setNumberOfCharOfBarCode(20); }) ```


Alternative Project Comparisons
Related Awesome Lists
Top Programming Languages

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Javascript (1,114,612
Code (18,140
Scanner (13,972
Bar Chart (10,175