Confirmation dialog on ng-click using Angular Material Services - AngularJS

Smith
Smith
2914 Points
78 Posts

I want to confirmation dialog box on click on delete button. I am using Angular Material service.

<a  ng-click="openConfirmationDialog();"><i class="material-icons">delete</i></a>

Thanks

Views: 9445
Total Answered: 1
Total Marked As Answer: 0
Posted On: 11-Jan-2017 04:54

Share:   fb twitter linkedin
Answers
Rahul Maurya
Rahul M...
4960 Points
31 Posts
         

Use $mdDialog.confirm() . Also you can follow https://material.angularjs.org/latest/demo/dialog

$scope.openConfirmationDialog = function() {
// Appending dialog to document.body to cover sidenav in docs app
var confirm = $mdDialog.confirm()
.title('Would you like to delete your debt?')
.textContent('All of the banks have agreed to forgive you your debts.')
.ariaLabel('Lucky day')
.ok('Please do it!')
.cancel('Sounds like a scam');
$mdDialog.show(confirm).then(function() {
$scope.status = 'You decided to get rid of your debt.';
}, function() {
$scope.status = 'You decided to keep your debt.';
});
};
 

 

Posted On: 11-Jan-2017 05:06
 Log In to Chat