-
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
RC5 Modal not working in multiple components #854
Comments
I'm also getting this error |
Adding |
@rspenc29 wow, let me try it with your technique :) |
@rspenc29 I tried, its not working for me. Everything works fine if the modal box is in the root component (appComponent). I get error when i put it in some other component. This is the error that i get:
P.S: Are you using RC5 and webpack? |
This works for me. I'm also using the
I did however have an issue with the backdrop and for now i'm using |
Thanks @rspenc29 - I will give it a shot with |
Yeah that fix doesn't work for me still get on feat-rc5 |
I'm experiencing the same issue with RC5. Only i'm trying to access Modals from a lazy loaded component inside of an NgModule. The offending code in ng2-bootstrap is inside the components-helper.service.js (see below)
The classOfRootComponent has a reference to my root component type (for most people this is AppComponent). The injector is not the root injector, but rather the injector associated with my lazy loaded module. So I'm guessing it does not have access to the root component instance of AppComponent. And so it bombs out. I have not been able to figure out a work around. |
same issue here. |
Is it working with feat-rc5? how do you got that via |
+1 |
I was able to get it to work using the feat-rc5 branch after some refactoring to import the ng2-bootstrap ModalModule. But it only worked after i set this.myModal.config.backdrop = false (instead of "static"). Which seems to be the same solution that @rspenc29 found. I think if you use the "static" value, it tries to find the root component in the injector and can't resolve it. @a5hik - i don't think you can install it via npm. i just downloaded it, and extracted it into my project until they do a full RC5 compatible release. |
To use
|
Hi now I'm able to use feat-rc5, I'm importing the ng2-bootstrap module like below.
However I get the same error when I try to use the modal ..in my lazy loaded module. I do specify the But I still face the same error.
I just wonder what I'm missing here, or how it works for others. |
The error is caused by the backdrop. Just disable it until they fix it. |
I started working after I change `[config]="{backdrop: 'static'}" to [config]="{backdrop: false}" |
thanks @rspenc29 @noxborough |
I face other issue, that If I run in `Can't bind to 'activeDate' since it isn't a known property of 'datepicker-inner'.
|
@a5hik See here angular/angular#10618 Also, can you post a quick guide on how to use feat-rc5? I updated my package.json to But now I only see .md files downloaded. I do not see any .ts files. |
You need to pull from git, detailed above from rob.
|
I tried with the webpack upgrade to get the |
v 1.1.0 - rc.5 |
I am using v1.1.1 with RC6 and i am still getting the same error: Perhaps i am missing anything? I do have to
|
ng2-bootstrap doesn't use or requires any AppComponent |
doing this in for the modal fixes the issue |
AppComponent is my main component (which has the hack as mentioned in the comment above) |
I don't have a |
Yeah its not available in the latest version. For now |
@hassanasad your solution just worked for the first time that modal opened , next time you open the modal , this error cames up : |
@valorkin I can confirm that config.backdrop = "static works fine with eagerly loaded components. But if the component that creates the modal dialog is part of a module that is lazy loaded (and it sets config.backdrop = "static"), than I still get the same error: "No provider for AppComponent!" As i stated in an earlier post, the error manifests itself in components-helper.service.js when trying to get the root app component from the injector.
|
Subscribed to this thread to follow the issue: valor-software/ngx-bootstrap#854
Subscribed to this thread to follow the issue: valor-software/ngx-bootstrap#854
OK, I see where is issue came from I will test fix on @flibbertigibbet repo, if work I will publish fix today |
Guys need a sample repo with issue to reproduce, thanks in advance. Seems I have found a solution, but need to fix it first |
Test it * |
@valorkin Now when i use a modal dialog inside of a component that is lazy loaded (and i have config.backdrop = "static"). It gets caught in an infinite loop. In the code below, appInstance is getting set to false because it is not found in the injector. And the injector's parentInjector is undefined.
|
I really need a code sample, where it fails On Thu, Sep 15, 2016, 01:12 noxborough [email protected] wrote:
|
haven't ever put a plunker together. working on putting one together that demonstrates the issue |
@valorkin https://plnkr.co/edit/PLF3dN?p=info However, if you go into my-modal.component.ts and switch from |
Confirmed, It worked well. Thanks |
@noxborough thank you so much! working on fix |
@noxborough your plunker was so helpful ! |
guys, 1.1.5 is published please confirm that fix is working properly |
WOW -- Thanks @valorkin after much effort from you and enough complaining from us, its finally working :) |
@valorkin I edited the plunker to use 1.1.5, and it didn't work. But only because i forgot to add the viewContainerRef hack in. All is well now. thanks for fixing. |
:happy: On Fri, Sep 16, 2016, 17:56 noxborough [email protected] wrote:
|
Updated to 1.1.5, it worked well, dont need to set this.myModal.config.backdrop = false; |
Hi,
I am using Angular RC5 and am able to open modal box in the root component (app-component) using
viewProviders: [BS_VIEW_PROVIDERS]
and keeping the modal box and button in the component template.However when i do the same for other components, it triggers an error:
Any ideas how to fix this please?
The text was updated successfully, but these errors were encountered: