我已经寻找解决方案近两天了。
我正在尝试使用 ngCordova 相机插件。
我将 ionic-yeoman 框架与 AngularJS 结合使用。
我所做的是:
bower install --save ngCordova.
Added ngCordova
to my app.module
。
安装cordova相机插件:
cordova plugin add org.apache.cordova.camera.
我的控制器:
.controller('profileCtrl', function($scope, myService, $cordovaCamera)
{
$scope.takePicture = function() {
var options = {
quality : 75,
destinationType : Camera.DestinationType.DATA_URL,
sourceType : Camera.PictureSourceType.CAMERA,
allowEdit : true,
encodingType: Camera.EncodingType.JPEG,
targetWidth: 100,
targetHeight: 100,
popoverOptions: CameraPopoverOptions,
saveToPhotoAlbum: false
};
$cordovaCamera.getPicture(options).then(function(imageData) {
// Success! Image data is here
}, function(err) {
// An error occured. Show a message to the user
});
}
myService.getFoo().then(function(data) {
//this will execute when the
//AJAX call completes.
$scope.items = data;
});
})
我收到此错误:ReferenceError:Camera is not defined