I played a little with ES6 and angular and I use eslint-plugin-angular to test my javascript. I have the following service:
export function runBlock ($rootScope, $state, $log) { 'ngInject'; $rootScope.$on( '$stateChangeStart', function(event, toState) {
But eslint gives me the following error:
The "$on" call should be assigned to a variable, in order to be destroyed during the $destroy event
I mean, I understand the warning, but I never did this in my previous angular projects, should I do what the error suggests? Why is it necessary / good practice?
The docs for eslint-plugin-angular referenced by John Papa angular styleguide , but I really did not find any mention of this situation.
javascript angularjs eslint
Dex3
source share