Open cjohn001 opened 1 year ago
You can register the view
registerElement('MLKitView', () => MLKitView);
in your main.ts
or app.module.ts
in v1.0.7.
@timdoege and @triniwiz thanks for the directions this solved the issue. But there seems to be a bug since 1.0.7 then. I also tried with 1.08 issue is the same.
To my understanding due to the referenced line below it should not be required to registerElement manually. And what is also somehow odd is, I usually include things the following way. But this does not work as isKnownView returns true. Seems something with the registration of the View is broken in the plugin
if (!isKnownView('MLKitView')) {
registerElement('MLKitView', () => require('@nativescript/mlkit-core').MLKitView);
}
Add the register to your app.module, also I'd remove the extra check.
@triniwiz , this is indeed how I did it. Added to app.module and removed isKnownCheck. Till 1.0.6 this was not required. Therefore I added the bug report. Is this now the intended behavior? In this case the issue could be closed. I would prefer the old way. saved a line of code :)
It's due to the angular upgrade, looks like you will need update angular to use a newer version if importing the module
@triniwiz : I am on 15.2.0, I can try out 15.2.1 I have just seen, but looks unlikely set a minor version would change something.
I just tried with: "@angular/animations": "15.2.1", "@angular/common": "15.2.1", "@angular/compiler": "15.2.1", "@angular/core": "15.2.1", "@angular/forms": "15.2.1", "@angular/platform-browser": "15.2.1", "@angular/platform-browser-dynamic": "15.2.1", "@angular/router": "15.2.1",
Situation is the same. Also needs registerElement('MLKitView', () => require('@nativescript/mlkit-core').MLKitView);
I am not sure if I understood what you mean
... looks like you will need update angular to use a newer version if importing the module
@triniwiz - If the following line was updated to use an imported class (and not a require call) then it should work:
import { MLKitView } from '@nativescript/mlkit-core';
registerElement('MLKitView', () => MLKitView);
Currently looking into the updated version 1.0.7 of MLKit in my Angular application. 1.0.6 is working fine. Seems like something is broken when loading the component. Even before getting in the view components init routine view loading breaks. I tried with Angular 15.1.4 and Angular 15.2.0, same behaviour. Following error in debugger:
In the angular template I load it as follows:
In the component _barcodeFormats is specified as:
this._barcodeFormats = [ BarcodeFormats.EAN_13, BarcodeFormats.EAN_8, BarcodeFormats.UPC_A, BarcodeFormats.UPC_E ];
The loaded method is not getting called. Things break before.
Dependencies