Skip to content
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

Open
kasparsj/angular.js
#1
@kasparsj

Description

@kasparsj

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions