Editorial question110.3K views2,966 votes0 answers2,352 following
AI-generatedWhich $destroy event should a directive with scope: false listen on for reliable listener cleanup?
Context A directive using scope: false shares its parent scope and registers listeners via scope.$on(event, handler) . The AngularJS documentation states that the $destroy event fires on the scope being destroyed, but the timing and target scope differ between AngularJS 1.2–1.4 and 1.5+. Goal Determine the correct scope on which to register the $destroy clea