我是AngalrJS中的新手,我試圖通過angularJS訪問webcamera。 因爲這個原因,我已經導入第三方庫webCam.js和使用指令(在這裏找到https://github.com/bcabanes/ng-camera)。如何在angularjs中訪問第三方庫(如webcam.js)1.5.2
但我收到以下錯誤:
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) {
});
FYI :我在腳本文件夾下的項目中添加了webcam.js,Cam.js,ng-camera.js ... 請建議cor直腸方式..
謝謝。
它worked..Thank你這麼多... –