i have popover in ionic framework app options: share , delete. need display confirmation popup when delete option chosen, don't know how.
how can done? need create separate controller popover? did popup comming actionsheet somehow different.
this controller:
$ionicpopover.fromtemplateurl('templates/popover.html', { scope: $scope }).then(function(popover) { $scope.popover = popover; }); // triggered on button click, or other target $scope.openpopover = function($event) { $scope.popover.show($event); };
and popover template:
<ion-popover-view style="height: 120px"> <ion-content> <div class="list"> <a class="item"> compartir </a> <a class="item"> eliminar </a> </div> </ion-content> </ion-popover-view>
you can place ng-click
on delete (or eliminar in template, think?)
<ion-popover-view style="height: 120px"> <ion-content> <div class="list"> <a class="item"> compartir </a> <a class="item" ng-click="showconfirm()"> eliminar </a> </div> </ion-content> </ion-popover-view>
$ionicpopover.fromtemplateurl('templates/popover.html', { scope: $scope }).then(function(popover) { $scope.popover = popover; }); // triggered on button click, or other target $scope.openpopover = function($event) { $scope.popover.show($event); }; $scope.showconfirm = function() { var confirmpopup = $ionicpopup.confirm({ title: 'are sure?', template: 'are sure want delete?' }); confirmpopup.then(function(res) { if(res) { console.log('you sure'); } else { console.log('you not sure'); } }); };