Hello friends,
I am once again with very interesting topic in ionic.
So my manager asked me to implement whats app like image change option.After searching allot finally i implemented the below solution.
HTML Code:-
<input type="button" ngClick="loadImage()">
Angular JS Code :-
$scope.loadImage=function()
{
$ionicActionSheet.show({
buttons: [
{ text: '<i class="icon ion-android-camera"></i> Camera' },
{ text: '<i class="icon ion-android-image"></i> Gallery' }, //Index = 0
],
destructiveText:'<i class="icon ion-android-cancel"></i> Cancel',
destructiveButtonClicked: function () {
return true;
},
titleText: 'Choose action',
buttonClicked: function(index) {
switch(index)
{
case 0:
{
window.plugins.toast.showShortBottom("Camera Selected",function(a){},function(b){});
//Write logic for Camera
}
break;
case 1:
{
window.plugins.toast.showShortBottom("Gallery Selected",function(a){},function(b){});
//Write logic for Gallery
}
break;
}
return true; //Close the model?
}
});
}
I am once again with very interesting topic in ionic.
So my manager asked me to implement whats app like image change option.After searching allot finally i implemented the below solution.
HTML Code:-
<input type="button" ngClick="loadImage()">
Angular JS Code :-
$scope.loadImage=function()
{
$ionicActionSheet.show({
buttons: [
{ text: '<i class="icon ion-android-camera"></i> Camera' },
{ text: '<i class="icon ion-android-image"></i> Gallery' }, //Index = 0
],
destructiveText:'<i class="icon ion-android-cancel"></i> Cancel',
destructiveButtonClicked: function () {
return true;
},
titleText: 'Choose action',
buttonClicked: function(index) {
switch(index)
{
case 0:
{
window.plugins.toast.showShortBottom("Camera Selected",function(a){},function(b){});
//Write logic for Camera
}
break;
case 1:
{
window.plugins.toast.showShortBottom("Gallery Selected",function(a){},function(b){});
//Write logic for Gallery
}
break;
}
return true; //Close the model?
}
});
}
Bye.. till then keep Asking..
0 comments