onemightyroar / angular-camera

Angular directive for easy webcam capture

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Returns undefined for image output

mranosa opened this issue · comments

<div class="col-md-12 text-center">
        <ng-camera
        type="photo"
        enabled="true"
        width="640"
        height="480"
        countdown="3"
        ng-model="media"
        overlay-src=""
        capture="callback(image)"
        capture-message="Go!"></ng-camera>
    </div>

Angular version : 1.2.15

works on watch, but not on callback

$scope.$watch('media', function(media) {
            console.log(media);
        });

mranosa, in your example above, I think that callback has to take the media parameter. I had this issue myself a couple of times, but I can verify that it's not broken as stated.

I'm having this issue too. Callback returns the previous image taken, undefined for the first one.

Will take a look at this as part of an upcoming release.

facing the same issue

Same issue here.

Same issue.
If you use the scope expression:

capture="yourCallback(media)"

and your directive use a scope definition of type:

captureCallback: '&capture',

then in your directive you have to call the callback passing the argument in this way:

scope.captureCallback({media:scope.media});

See: https://docs.angularjs.org/api/ng/service/$compile -> scope -> & or &attr

I have some issue here.
I got
angular.js:13550 TypeError: Cannot use 'in' operator to search for 'capturePhoto' in data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/2wBDAQMDAwQDBAgEBAgQCwkLEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBD/wAARCADwAUADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0 ...