0.0.2 • Published 3 years ago

hng-barcode v0.0.2

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

HngBarcode

This library was generated with Angular CLI version 11.2.5.

Installation

npm install hng-barcode

Usage

Add HngBarcodeModule to your module imports (ex. app.module.ts):

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
import { HngBarcodeModule } from 'hng-barcode';
import { HomeComponent } from './components/home/home.component';

@NgModule({
  declarations: [AppComponent,HomeComponent],
  imports: [BrowserModule, FormsModule, HngBarcodeModule],
  bootstrap: [AppComponent]
})

Below is example on how to use it. I have generated HomeComponent as shown in the app.module above.

home.component.html

<hng-barcode barcodeLength=5 barcodeLabel='My custom barcode' (onScanEvent)="onScan($event)">
</hng-barcode>

home.component.ts

onScan(value: string){
    //Do something with the scanned value
}

Attributes

Attribute nameTypeDefaultDescription
barcodeLengthNumber5Minimum 5 character length to scan is required
barcodeLabelString'Barcode input'Barcode label
onScanEventOutputThis decorator emits the scanned value

Github

Visit https://github.com/hendrang for examples and source code