This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
the $emit loop is not aware which listener was removed #13401
Description
if $rootScope has 2 listeners attached for one event name, and the first registered listener removes itself, then the second listener will never be called.
this is because the $emit loop processes listeners in a for loop, and whilst processing the first listener, the namedListeners array will be spliced, thus the second listeners index will become 0 instead of 1.