You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
We have page with two handlers that bound to "sampleEvent", 3 buttons that broadcasts and unbinds handlers, block with displayed $$listenerCount value.
sampleEvent count equal 2
Click "Emit simple event"
Two alerts should appear
Click "Unregister first handler"
sampleEvent count equal 1
Click "Emit simple event"
One alert should appear
Click "Unregister first handler" second time
Actual result:
There is no sampleEvent count and second handler is not triggered after broadcast 'sampleEvent'
Expected result:
sampleEvent should still be 1 and second handler should be triggered after broadcast 'sampleEvent'
I'm going to create pull request with fix for this bug after few minutes.
The text was updated successfully, but these errors were encountered:
Check that listener is still present in $$listeners before decrease
$$listenerCount. It fixes problem with incorrect $$listenerCount after
call deregistering function multiple times.
Closes#9666Closes#9667
Check that listener is still present in $$listeners before decrease
$$listenerCount. It fixes problem with incorrect $$listenerCount after
call deregistering function multiple times.
Closes#9666Closes#9667
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hello,
I've notice that when you call deregistration function more than one time it decrease $$listenerCount each time.
https://github.com/angular/angular.js/blob/master/src/ng/rootScope.js#L1105-L1108
After $$listenerCount becomes zero $breadcast starts ignore this event and It cause that other listeners for the same event will not be called.
https://github.com/angular/angular.js/blob/master/src/ng/rootScope.js#L1219
Reproducing
Here is plunker and steps to reproduce:
http://plnkr.co/edit/bHtWlu?p=preview
We have page with two handlers that bound to "sampleEvent", 3 buttons that broadcasts and unbinds handlers, block with displayed $$listenerCount value.
Actual result:
There is no sampleEvent count and second handler is not triggered after broadcast 'sampleEvent'
Expected result:
sampleEvent should still be 1 and second handler should be triggered after broadcast 'sampleEvent'
I'm going to create pull request with fix for this bug after few minutes.
The text was updated successfully, but these errors were encountered: