An open API service indexing awesome lists of open source software.

https://github.com/patrickjs/angular-off

Providing the method $off for $rootScope in Angular.js
https://github.com/patrickjs/angular-off

Last synced: 15 days ago
JSON representation

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

Awesome Lists containing this project

README

          

# angular-off [![Build Status](https://travis-ci.org/gdi2290/angular-off.png?branch=master)](https://travis-ci.org/gdi2290/angular-off)

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

#How do I add this to my project?

You can download angular-off by:

* (prefered) Using bower and running `bower install angular-off --save`
* Using npm and running `npm install angular-off --save`
* Downloading it manually by clicking [here to download development unminified version](https://raw.github.com/gdi2290/angular-off/master/angular-off.js)

````html

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);
};

});

````