Skip to content

Latest commit

 

History

History
41 lines (26 loc) · 948 Bytes

on-destroy.md

File metadata and controls

41 lines (26 loc) · 948 Bytes

on-destroy - Check for common misspelling $on('destroy', ...).

It should be $on('$destroy', ...).

Rule based on Angular 1.x

Examples

The following patterns are considered problems;

/*eslint angular/on-destroy: 2*/

// invalid
$rootScope.$on('destroy', function () {
    // ...
}); // error: You probably misspelled $on("$destroy").

The following patterns are not considered problems;

/*eslint angular/on-destroy: 2*/

// valid
$scope.$on('$destroy', function () {
    // ...
});

// valid
var unregister = $rootScope.$on('$destroy', function () {
    // ...
});

Version

This rule was introduced in eslint-plugin-angular 0.1.0

Links