I currently find myself in the process of integrating a barcode scanner into my Angular 4 project, with the assistance of this plugin - https://github.com/isonet/angular-barcode-scanner.
Within my scanner.component.ts
page, I have included:
import { Component, OnInit } from '@angular/core';
import 'angular-barcode-scanner';
In my app.module.ts
file:
...
import { BarcodeScanner} from 'angular-barcode-scanner';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
FormsModule,
HttpModule,
RouterModule.forRoot(routes),
LoginModule,
SignupModule,
DashboardModule,
ReactiveFormsModule,
BarcodeScanner
],
providers: [
DataService,
TokenService
],
bootstrap: [AppComponent]
})
export class AppModule { }
Furthermore, within my scanner.component.html
file:
<barcode-scanner separator-char="separatorChar" trigger-char="triggerChar" scan-callback="scanCallback"
trigger-callback="triggerCallback"></barcode-scanner>
</div>
</div>
However, upon execution, I encounter the following errors in console:
Uncaught ReferenceError: angular is not defined
at Object.defineProperty.value (angular-barcode-scanner.js:1)
at r (angular-barcode-scanner.js:1)
...
If anyone can provide any insight or help regarding this matter, it would be greatly appreciated.