Invalid camera object in loaded event
I don't know why I have invalid object in loaded event. It doesn't have any methods, that CameraPlus should have...
public camLoaded(e: any): void {
console.log('***** cam loaded *****');
this.cam = e.object as CameraPlus;
let flashMode = this.cam.getFlashMode();
...
I've got:
ERROR TypeError: this.cam.getFlashMode is not a function
this.cam object looks like a view, but it is not camera :|
It behaves the same in Genymotion emulator and real device.
What's your template look like?
Sorry, I should have included it at the beginning...
<GridLayout class="page page-content" rows="*, auto" columns="*">
<CameraPlus debug="true"
galleryPickerMode="single"
showFlashIcon="true"
showToggleIcon="true"
showCaptureIcon="true"
showGalleryIcon="true"
(loaded)="camLoaded($event)"
(toggleCameraEvent)="toggleCameraEvent($event)"
(photoCapturedEvent)="photoCaptured($event)"
(imagesSelectedEvent)="imagesSelectedEvent($event)">
<!-- OVERLAY CONTENT-->
<GridLayout rows="*, auto" columns="*">
<Label class="timer-label" row="1" [text]="timerLabel"></Label>
</GridLayout>
</CameraPlus>
<Button class="cancel-button" row="1" text="Anuluj" isEnabled="{{!cancelRequested && countdown > 1}}" (tap)="onCancelTap($event)"></Button>
</GridLayout>
but I've also tried your template and code from demo-ng... the same result.
when i look at the object in loaded event, one thing catches my eye:
"_isAddedToNativeVisualTree": false,
does it mean that it is not initialized properly?
Damn, it was this part that was missing... I've missed:
registerElement("CameraPlus", () => <any>CameraPlus);
Sorry :\
This should be added to the ng-demo example, or as a comment in the README, the problem is that i was assuming that the plugin was taking care of this, similar to camera permissions. Besides this small thing, the plugin works really well, great job
tnx author.