Reputation: 431
I am using the cordova-plugin-camera to capture image using phone camera . I have a button in my html page as below
<a class="item item-thumbnail-left" href="#">
<img src="img/preview.png">
<button class="button button-block button-positive upload-btn" ng-click="addImage12()">
capture
</button>
</a>
below is my controller
.controller('imageController',function($scope,$state,$rootScope,toaster,$translate,$cordovaCamera){
$scope.addImage12 = function() {
var options = {
quality: 80,
destinationType: Camera.DestinationType.DATA_URL,
sourceType: Camera.PictureSourceType.CAMERA,
allowEdit: false,
encodingType: Camera.EncodingType.JPEG,
targetWidth: 250,
targetHeight: 250,
popoverOptions: CameraPopoverOptions,
saveToPhotoAlbum: false
};
$cordovaCamera.getPicture(options).then(function(imageData) {
$scope.srcImage = "data:image/jpeg;base64," + imageData;
console.log($scope.srcImage);
window.preventDefault();
}, function(err) {
console.log(err);
window.preventDefault();
});
};
})
Everything seems to be working fine till the capturing the image part .when I click on the tick button after the image capture It is taking me back to the app's first page instead staying in the same page from where the button is clicked.any help would be appreciated.
Upvotes: 0
Views: 649
Reputation: 8484
I think the problem is because of closing your app because of opening the native application(camera). May be your app will start from the first if minimized. If it is there, Please solve that issue and try to stay in the current state.
http://tripleneo.nl/resume-app-using-angularjs-ionic/ see this link
After reading that, in your case there should not be any confirm dialogue, Just send the user to the current camera state
Upvotes: 1