Skip to content

Latest commit

 

History

History
37 lines (26 loc) · 1.19 KB

README.md

File metadata and controls

37 lines (26 loc) · 1.19 KB

angular-off Build Status

Providing the method $off for $rootScope in Angular.js

#How do I add this to my project?

You can download angular-off by:

  • Using bower and running bower install angular-off --save This is a very old version it seems.
  • Using npm and running npm install angular-off --save
  • Adding this repo to your bower.json file
  • Downloading it manually by clicking here to download development unminified version
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.10/angular.min.js"></script>
<script src="app/bower_components/angular-off/angular-off.js"></script>
<script>
  angular.module('YOUR_APP', [
    'controllers'
  ]);

  angular.module('controllers', [])
    .controller('MainCtrl', function() {

      $scope.$on('$routeChangeError', function alertEvent(event, current, prevous, rejection) {
        alert('Filed to change routes!');
      });

      $scope.button = function() {
       $scope.$off('$routeChangeError', alertEvent);
      };

    });
</script>