Hi everyone, Am new to both ionic and angularJS. This is what am trying to achieve:
Open up the camera options using “navigator.camera.getPicture” when a user tap a button. below in my code but it is not working, what am i doing wrong please.
.controller('BuyCtrl', function($scope) {
function GetImage() {
navigator.camera.getPicture( cameraSuccess, cameraError, {
quality: 100,
sourceType : Camera.PictureSourceType.PHOTOLIBRARY,
destinationType: Camera.DestinationType.DATA_URI,
encodingType: Camera.EncodingType.JPEG,
saveToPhotoAlbum: true,
cameraDirection = Camera.Direction.BACK
});
function cameraSuccess(imageData) {
var image = document.getElementById('bookImg');
// image.src = imageURI;
image.src = "data:image/jpeg;base64," + imageData;
}
function cameraError(message) {
alert('Failed because: ' + message);
}
}
})