Newbie Question - How to implement camera functions

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);
}

}
})

This is more of a cordova/angular question that issues with ionic…

But if you need some help on how to work with cordova functions with angular, check out this repo.

The guy wrapped the cordova functions as services, which makes it much easier to work with them in an angular sense

Awesome, thats what I need. Thanks so much.

check this