Javascript Angular/Phonegap应用程序:无法使用文件URI显示图像
我使用Phonegap的getPicture()方法将文件URI保存到一个图像中,然后我尝试在img元素中显示该图像,但无法。这里有更多的细节Javascript Angular/Phonegap应用程序:无法使用文件URI显示图像,javascript,angularjs,cordova,Javascript,Angularjs,Cordova,我使用Phonegap的getPicture()方法将文件URI保存到一个图像中,然后我尝试在img元素中显示该图像,但无法。这里有更多的细节 我有一个具有以下图像元素的视图: 当我按下视图中的按钮时,它会调用视图控制器中的getPhoto()方法。以下是控制器的代码: .controller('captureController',function($scope,$rootScope,$state,$document){ $scope.getPhoto = function() { navi
.controller('captureController',function($scope,$rootScope,$state,$document){
$scope.getPhoto = function() {
navigator.camera.getPicture(
captureSuccess,
captureError,
{
quality:5,
destinationType: Camera.DestinationType.FILE_URI,
sourceType: Camera.PictureSourceType.CAMERA,
encodingType: Camera.EncodingType.PNG
}
);
}
function captureSuccess(imageURI) {
var image = document.getElementById('myImage');
$rootScope.imageSrc=imageURI
$rootScope.$apply()
alert($rootScope.imageSrc)
}
function captureError(error) {
var msg = 'An error occurred during capture: ' + error.code;
alert('there was an error')
}
})