0.0.2 • Published 3 years ago
hng-barcode v0.0.2
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 name | Type | Default | Description |
---|---|---|---|
barcodeLength | Number | 5 | Minimum 5 character length to scan is required |
barcodeLabel | String | 'Barcode input' | Barcode label |
onScanEvent | Output | This decorator emits the scanned value |
Github
Visit https://github.com/hendrang for examples and source code