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

not working on redirect to another component #29

Open
vk011 opened this issue Sep 29, 2017 · 4 comments
Open

not working on redirect to another component #29

vk011 opened this issue Sep 29, 2017 · 4 comments

Comments

@vk011
Copy link

vk011 commented Sep 29, 2017

Hello,

I have it all set in one component and there flash messages work, however if i redirect from that component to another component (where I have imported the package and added it as a dependency in the constructor and the view tags in its template), I do not see the error message and after the timeout I get this error:

ERROR Error: ViewDestroyedError: Attempt to use a destroyed view: detectChanges
    at viewDestroyedError (core.es5.js:8451)
    at Object.debugUpdateDirectives

Is it even possible?

@moff
Copy link
Owner

moff commented Nov 21, 2017

@vk011 thanks for your feedback! Can you please check if it works with updated version of the package?

@Senegal
Copy link

Senegal commented Nov 21, 2017

this problem is still alive for me. If try to navigate by route while alert is showing -got same error in console

@mikebrsv
Copy link
Contributor

You should place <flash-messages></flash-messages> into the parent component.

@susheelbanyal
Copy link

susheelbanyal commented Mar 8, 2018

I am heaving the same issue. While redirecting and if the flash message is still there then it shows the view destroy error.
ERROR Error: ViewDestroyedError: Attempt to use a destroyed view: detectChanges at viewDestroyedError (core.es5.js:8451) at Object.debugUpdateDirectives
I have separate components. So there is only one parent which is app.component.html.
I am redirecting to the same level.

I have comment **angular2-flash-message/module/flash-messages.component.js** on line number 36 comment 
//this._cdRef.detectChanges();

and it is working. Please suggest a better solution. I don't want to change the main module.
Advance thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants