如何在angularjs 1.5.2

时间:2017-01-14 07:31:56

标签: angularjs webcam.js

我是AngalrJS的新手,我正试图通过angularJS访问webcamera。 出于这个原因,我导入了第三方库webCam.js和used指令(在这里找到https://github.com/bcabanes/ng-camera)。

但是我收到以下错误:

  

未捕获错误:[$ injector:modulerr]无法实例化模块   myModule由于:错误:[$ injector:modulerr]无法实例化   模块摄像头由于:错误:[$ injector:nomod]模块'webcam'不是   可以!您要么错误拼写了模块名称,要么忘记加载它。   如果注册模块,请确保将依赖项指定为   第二个论点。   http://errors.angularjs.org/1.5.8/ $注射器/ NOMOD?P0 =摄像头

这是我的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) {

});

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

感谢。

1 个答案:

答案 0 :(得分:0)

您需要不注入webcam,而是camera

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

});
相关问题