I have two buttons that would make different actions, but for some reason I can not, and just call the same function. It seems strange that happens, they are all tightly closed tags and I never had happened. Most likely it is my mistake, but I can not find it
For example, the first button calls the getPhoto()
(function), this leaves some logs for the beginning of each function and thus identify which called.Effectively it works on the first button, unlike the second calls the function getPicture()
but when to click, call "getPhoto"
<label class="toggle toggle-assertive">
<button class="button button-small button-orange" ng-click="getPhoto()">
Tomar imagen
</button>
<button class="button button-small button-orange" ng-click="getPicture()">
Seleccionar imagen
</button>
</label>
Function :
$scope.getPicture = function(){
console.log("GET PICTURE");
var options = {
quality: 50,
destinationType: Camera.DestinationType.FILE_URI,
sourceType : Camera.PictureSourceType.PHOTOLIBRARY,
popoverOptions: CameraPopoverOptions,
};
Camera.getPicture(options).then(function(imageURI) {
$scope.lastPhoto = imageURI;
}, function(err) {
// error
});
};
$scope.getPhoto = function() {
console.log("GET PHOTO");
var options = {
quality: 50,
destinationType: Camera.DestinationType.FILE_URI,
allowEdit: true,
encodingType: Camera.EncodingType.JPEG,
popoverOptions: CameraPopoverOptions,
saveToPhotoAlbum: true,
correctOrientation: true
};
Camera.getPicture(options).then(function(imageURI) {
//console.log(imageURI);
$scope.lastPhoto = imageURI;
}, function(err) {
// error
});
};