我正在尝试在IONIC CORDOVA项目中添加QRScanner插件;所以我跑
ionic cordova plugin add cordova-plugin-qrscanner
npm install --save @ionic-native/qr-scanner
在我的项目文件夹中。
然后在app.module.ts
中添加了
import {QRScannerOriginal}from '@ionic-native/qr-scanner'
和providers
中的
providers: [
StatusBar,
Splashscreen,
{provide: ErrorHandler, useClass: IonicErrorHandler},
QRScannerOriginal
]
能给我一些帮助吗?
当我使用ionic serve
运行项目时,收到此运行时错误:
Error: Invalid provider for the NgModule 'AppModule' - only instances of Provider and Type are allowed, got: [StatusBar, Splashscreen, [object Object], ?undefined?]
at http://localhost:8100/build/main.js:31780:23
at Array.forEach (<anonymous>)
at CompileMetadataResolver._getProvidersMetadata (http://localhost:8100/build/main.js:31744:19)
at CompileMetadataResolver._loadNgModuleMetadata (http://localhost:8100/build/main.js:31527:50)
at CompileMetadataResolver.loadNgModuleMetadata (http://localhost:8100/build/main.js:31410:29)
at RuntimeCompiler._loadModules (http://localhost:8100/build/main.js:47996:41)
at RuntimeCompiler._compileModuleAndComponents (http://localhost:8100/build/main.js:47966:35)
at RuntimeCompiler.compileModuleAsync (http://localhost:8100/build/main.js:47956:21)
at PlatformRef_._bootstrapModuleWithZone (http://localhost:8100/build/main.js:33638:25)
at PlatformRef_.bootstrapModule (http://localhost:8100/build/main.js:33620:21)