Confirmation dialog on ng-click - AngularJS

后端 未结 17 1528
一向
一向 2020-11-30 00:03

I am trying to setup a confirmation dialog on an ng-click using a custom angularjs directive:

app.directive(\'ngConfirmClick\', [
    function()         


        
17条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-30 01:03

    Its so simple using core javascript + angular js:

    $scope.delete = function(id) 
        { 
           if (confirm("Are you sure?"))
               {
                    //do your process of delete using angular js.
               }
       }
    

    If you click OK, then delete operation will take, otherwise not. * id is the parameter, record that you want to delete.

提交回复
热议问题