Create a simple Bootstrap Yes/No confirmation or just notification alert in AngularJS

后端 未结 5 1681
灰色年华
灰色年华 2020-12-02 18:49

It\'s so simple in a non-Angular environment. Just html and a two line of js code to show a modal confirmation dialog on the screen.

Now I am developting an AngularJ

5条回答
  •  情深已故
    2020-12-02 19:16

    You can use the Angular Confirm library.

    When included, it's became available as a directive:

    
    

    As well as a service:

    angular.module('MyApp')
      .controller('MyController', function($scope, $confirm) {
        $scope.delete = function() {
          $confirm({text: 'Are you sure you want to delete?', title: 'Delete it', ok: 'Yes', cancel: 'No'})
            .then(function() {
              // send delete request...
            });
        };
      });
    

提交回复
热议问题