-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
bug(modal): Cannot read property 'body' of undefined (document not injected) #575
Comments
very interesting, it means that there no |
@valorkin I'm as confused as you are it seems :). This is all in a huge messed-up app... I will try (hopefully tomorrow) to create a contained instance where I can reproduce this. |
yeap, I am confused :) |
@valorkin Do you still need a reproduction?. Have the same error. I could setup a plnkr if still necessary. |
@dennisx5 I will appreciate a plunkr Thanks in advance! |
I have exactley the same problem. I want the redirect the user to another route, after the modal has closed. To fix it in the meanwhile I used this stupid solution: Template
Component
it seems that it takes some time, until the DOM has been updated or cleared. I dont know |
@valorkin Here is the example https://github.com/GreenToast/Angular2Starter/tree/bug/ng2bootstrap-modal. "npm install" for setup and "npm start" to start it. Look in the dashboard.component in app/dashboard. There is a delete-button and an according dummy-delete-action. After which I want to leave the page. The error is thrown during the navigate. Like @crebuh assumes, I think it's an asynchronous Action to close the dialog, which is executed too late or after the navigate is done. |
I am also having this problem. In my modal template I have these two buttons. The first has no problem, but the second tries to navigate after closing the modal.
I'm accessing the modal like this:
Then I'm using it like this:
I'm using @crebuh's workaround for now and that seems to be working. |
Same problem here. |
When will this be fixed? |
@valorkin what is the fix to this problem? I don't mind sending a pull request as the workaround is very bad. Thanks! |
Same problem here - any indications when this will be resolved? Issue is opened since Jun 3, and the workaround isn't scalable... Please assist! |
Have to try couple of things, but it seems injecting document token, not always behave correctly:( |
I am on it, I will get you updated |
@valorkin, great thanks! |
I am also having this problem. while using @ViewChild("autoShownModal", { static: false }) showModal(): void {
} hideModal(): void { onHidden(): void { 0|front | TypeError: Cannot read property 'body' of undefined Thanks in advance...... |
First off: Great job on the modal. Very easy to use.
I have a situation where I close the modal, and perform an action -> where the action ends up taking me somewhere else within my app.
I do something like this :
(click)="dealReviewModal.hide(); confirmDeal();"
My
confirmDeal()
will do some work and will change the display of the page... but this error shows up:The curious aspect that I have found is that within my
confirmDeal()
, if I set asetTimeout
of 500ms, then the modal hides, and everything works as it should.Any ideas?
The text was updated successfully, but these errors were encountered: