angularjs 1.5.2中如何访问第三方库如webcam.js

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

我是 AngalrJS 的新手,我正在尝试通过 angularJS 访问网络摄像头。 出于这个原因,我导入了第三方库 webCam.js 并使用了指令(在此处找到 https://github.com/bcabanes/ng-camera)。

但我收到以下错误:

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

这是我的 HTML 代码:

        <!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>

这是我在 Cam.js 文件中的代码:

/// <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) {

});

仅供参考:我在脚本文件夹下的项目中添加了 webcam.js、Cam.js、ng-camera.js... 请建议正确的方法..

谢谢。

您需要注入的不是 webcam,而是 camera

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

});