Never Perfectly Managed

npm

Need private packages and team management tools?Check out npm Orgs. »

angular-beforeunload

0.0.2 • Public • Published

angular-beforeunload

Confirm dialog pop up if they try and (or accidently click away from) the page.

angular.module('YOUR_APP', [
  'angular-beforeunload'
])
  .controller('MainCtrl', function(BeforeUnload) {
    // Bind a listener on your current $scope and save reference to it.
    var onbeforeunload = $scope.$on('$locationChangeStart', BeforeUnload.init('TOP_MESSAGE', 'BOTTOM_MESSAGE'))
    // In this controller the user will be prompted to
    // confirm their choice before they change their location.
    $scope.submitPage = function() {
      // If you invoking your reference then your listener becomes null.
      onbeforeunload();  
    };
    
  });

Keywords

none

install

npm i angular-beforeunload

Downloadsweekly downloads

0

version

0.0.2

license

none

last publish

collaborators

  • avatar
Report a vulnerability