Describe the bug
It related to the following line as I have tried to copy your example on plunker.
<zxing-scanner #scanner start="cameraActive" [device]="devicex" (scanSuccess)="handleQrCodeResult($event)"></zxing-scanner>
@NgModule({
declarations: [
MyApp, ImageEditPage, ImageCropperComponent
],
imports: [
BrowserModule,
CommonModule,
HttpClientModule,
FormsModule,
ZXingScannerModule.forRoot(),
TranslateModule.forRoot({
loader: {
'provide': TranslateLoader,
'useFactory': (createTranslateLoader),
'deps': [HttpClient]
}
}),
IonicModule.forRoot(MyApp),
IonicStorageModule.forRoot()
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
ImageEditPage
],
providers: [
AlertService,
AssetService,
AuthService,
DeviceService,
Geolocation,
GPSService,
LocationService,
UserService,
Camera,
Crop,
CameraService,
TagService,
Dialogs,
SplashScreen,
StatusBar,
{ 'provide': ErrorHandler, 'useClass': IonicErrorHandler }
]
})
ionic 3
android 7.1.1
browser 5.0.3
cordova 8.0.0
Please provide your @zxing/ngx-scanner version. 馃檪
"@zxing/ngx-scanner": "^1.2.0",
"@zxing/library": "^0.7.0",
Don't you have any output, error log or something else?
ERROR Error: Uncaught (in promise): Error: Template parse errors:
Can't bind to 'device' since it isn't a known property of 'zxing-scanner'.
"): ng:///QRScannerPageModule/QRScannerPage.html@5:61
'zxing-scanner' is not a known element:
"): ng:///QRScannerPageModule/QRScannerPage.html@5:61
'zxing-scanner' is not a known element:
This looks like a user-code error, me myself had to deal with errors like this several times. Probably you forgot to include the ZXingScannerModule in your feature module. Please review your app to make sure you're not forgeting anything. 馃檪
If there's any question yet, feel free to ask.
@moleisking Did you resolve this? Having the exact same issue (ionic)
I have included the module in the main app class:
...
import { ZXingScannerModule } from '@zxing/ngx-scanner';
...
@NgModule({
...
imports: [
ZXingScannerModule.forRoot()
],
...
})
export class AppModule {
constructor() {
}
}
Then in my page I am importing it again:
...
import {ZXingScannerComponent} from '@zxing/ngx-scanner';
...
export class ScanPage {
scanner: ZXingScannerComponent;
}
But getting the same error as you:
Can't bind to 'device' since it isn't a known property of 'zxing-scanner'.
1. If 'zxing-scanner' is an Angular component and it has 'device' input, then verify that it is part of this module.
2. If 'zxing-scanner' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("ner page-scan-camera-ready">
<zxing-scanner #scanner class="test-class" start="true" [ERROR ->][device]="selectedDevice" (scanSuccess)="handleQrCodeResult($event)"></zxing-scanner>
...
'zxing-scanner' is not a known element:
1. If 'zxing-scanner' is an Angular component, then verify that it is part of this module.
2. If 'zxing-scanner' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. (" <div [hidden]="!hasPermission"
I assume the root cause is the part 'zxing-scanner' is not a known element: but I don't see how we can include that?
@odahcam any thoughts on what might be wrong would be appreciated
I don't remember using the .forRoot() method for importing, try without it.
It doesn't seem to make much difference either way. I found the .forRoot() in another example.
It must be old, can you set a StackBlitz example for me to debug?
ZXingScannerModulein your feature module
here the feature module that you're referring in config.xml?
if yes, kindly provide a sample
Sorry, what config.xml? ZXingScannerModule is not a feature module, that module is a sub module of your main AppModule.
I'm using Cordova to build angular application for android, it has common config.xml for android, ios and other OSes... I need help to make the component work.
P
I'm using Cordova to build angular application for android, it has common config.xml for android, ios and other OSes... I need help to make the component work.
Please make your Angular application works on browser first. You are messing things up.
P
I'm using Cordova to build angular application for android, it has common config.xml for android, ios and other OSes... I need help to make the component work.
Please make your Angular application works on browser first. You are messing things up.
it's working well with browsers. After I install the same as an android app it's shows nothing
I curious about that same as an android app. You are using Cordova pf to build the native app right?
Could you try to map Angular with Cordova?
I've build Angular application first, then, i took production build and copied into cordova "www" folder and build output as apk. Before took apk file, i've tried with cordova browser the component worked as expected. But on mobile, it's a blank screen also it not asks for camera permission also
Ok
Thank you so much for the help @thanhphuocdang and good luck @thatham.
I'm locking because this ran out of the issue's topic, feel free to open a new one if needed. 馃檪