angularjswebcam.js

How to access third party libraries such as webcam.js in angularjs 1.5.2


I am new in AngalrJS ,I am trying to access the webcamera through the angularJS. For that reason i have imported the third party library webCam.js and used directive (Found here https://github.com/bcabanes/ng-camera).

But I am getting the following error:

Uncaught Error: [$injector:modulerr] Failed to instantiate module myModule due to: Error: [$injector:modulerr] Failed to instantiate module webcam due to: Error: [$injector:nomod] Module 'webcam' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. http://errors.angularjs.org/1.5.8/$injector/nomod?p0=webcam

Here is my HTML code :

        <!DOCTYPE html>
<html>
<head>
    <script src="Scripts/angular.js"></script>
    <script src="Scripts/webcam.js"></script>
    <script src="Scripts/ng-camera.js"></script>
    <script src="Scripts/Cam.js"></script>
</head>

<body ng-app="myModule">
        <div ng-controller="myContoller">
        <ng-camera
            capture-message="Cheeeese!"
            countdown="3"
            output-height="160"
            output-width="213"
            viewer-height="320"
            viewer-width="426"
            crop-height="90"
            crop-width="120"
            image-format="jpeg"
            jpeg-quality="100"
            action-message="Take picture"
            snapshot="vm.picture"
            flash-fallback-url="/vendors/webcamjs/webcam.swf"
            overlay-url="/overlay.png"
            shutter-url="/shutter.mp3"></ng-camera>
    </div>
</body>

</html>

Here is my code in Cam.js file :

/// <reference path="angular.js" />
/// <reference path="webcam.js" />
/// <reference path="webcam.min.js" />
var app = angular.module("myModule", ['webcam']);
app.controller("myContoller", function ($scope, $http, $log) {

});

FYI :I have added webcam.js,Cam.js,ng-camera.js in my project under Scripts folder... please suggest the correct way..

Thanks.


Solution

  • You need to inject not webcam, but camera

    var app = angular.module("myModule", ['camera']);
    app.controller("myContoller", function ($scope, $http, $log) {
    
    });