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

Cannot read property 'unsubscribe' of undefined!!! #20

Closed
dsl-src opened this issue May 22, 2016 · 3 comments
Closed

Cannot read property 'unsubscribe' of undefined!!! #20

dsl-src opened this issue May 22, 2016 · 3 comments
Labels

Comments

@dsl-src
Copy link
Contributor

dsl-src commented May 22, 2016

I use authorization component which checks if user is authorize to see protected page where I have and SimpleNotificationsComponent. In case of unauthorized attempt, the authorization component uses Router and navigates to login page. And in that case I got:

Unhandled promise rejection TypeError: Cannot read property 'unsubscribe' of undefined(…)

which leads to NotificationComponent and:

ngOnDestroy()
{
this.addToastSubscriber.unsubscribe()
this.clearToastsSubscriber.unsubscribe()
}

It is probably because of component not being initializes in ngOnInit.

@Stabzs
Copy link
Owner

Stabzs commented May 22, 2016

The listener that is trying to unregister doesn't appear to be part of the toaster component. Can you please create a small plunkr that demonstrates this behavior?

@dsl-src
Copy link
Contributor Author

dsl-src commented May 22, 2016

I made the Pull Request to fix this problem.
Please accept it. I really like this library but this problem does not allow her to use.

@Stabzs Stabzs closed this as completed in b79e4ca May 22, 2016
@Stabzs
Copy link
Owner

Stabzs commented May 23, 2016

This has been published as 0.3.1-rc.1 via b88eb5a.

Please note that while coveralls reported test coverage remained at 100%, branch coverage dropped and had to be corrected in the above commit. Going forward, if you contribute, please make sure to add appropriate tests and regenerate test coverage to ensure proper coverage of all code paths and branches.

@Stabzs Stabzs added the bug label Jun 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants