-
Notifications
You must be signed in to change notification settings - Fork 25k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@Output not working properly from global context even with ngzone.run() #46288
Comments
You are assigning (window as any).testCallback = () => {
this.zone.run(() => {
this.someEvent.emit('mesage from child @Output');
});
}; New instances of |
I felt that would be the case. It's a shame, but relief still came. Thank you! |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Which @angular/* package(s) are the source of the bug?
core
Description
If for
@Output
you create a callback in a global context (for example, as a property of awindow
object) and then try to emits events from this callback, only the first call will work. Further attempts to make emits will not work even withngzone.run()
.You can see this bug on stackblitz or on my repository. If you try to click the "first" link and then the "second" link, everything will work as expected. But if you try to do it again, when you click on "second" you will not see the output message from the child
mesage from child @Output
.In my case, I created several child components, each of which works with its vendor to login through social networks (Facebook, Google, etc.). These vendors call callbacks from a global context. In this case, I can't rely on using
@Output
because they don't work properly.Environment
The text was updated successfully, but these errors were encountered: