-
Notifications
You must be signed in to change notification settings - Fork 97
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
ViewChild undefined in AoT #116
Comments
After some testing... Don't know if ts an issue with in this lib or AoT compiler itself, although this is the first time I encountered this problem. Maybe worth properly testing and referencing in the docs. |
This looks like an angular issue to me. On another note: |
I can't use canEnter, since I don't have a separate button for next step. |
Ok, I didn't think about such a scenario when designing the directives and components. |
My best suggestion is to make a shared service for controlling the wizard, so we don't have to resort to ViewChild. Other than that I don't think there is much you can do. Any external code could require the wizard to change steps. we just need a simple way to control it. The above code works. For the time being, just make a note about AoT compatibility in the docs. It works only if you get the ViewChild by string, not by the component class. Unless this is a problem directly related to this lib, not AoT compiler (in not sure which is the case, never had this issue before, then again I tend to stay clear from ViewChild generally), I suggest you look into it. My best guess is that it's a AoT compiler issue for whatever reason, but I could be wrong. |
My problem with a shared service is, how should the user select the correct wizard instance? I know other libraries support a shared service to access concrete instances of their main components. |
Plz @madoar can this solution added to Documentation for a programatically implementation? |
@segux I'm not sure, if this needs to be separately added to the documentation for |
I fell down too in this problem. A temporary alert on angular-archwizard documentation (about the workaround way to use ViewChild) would have saved me time. |
I change it: to it: and works using Tks @zolakt !!! |
@talesporto the solution also helped me, and definitely should be in documentation 👍 |
@talesporto, I'm using a webpack and this works with me. Thanks 👍. |
Hi,
I'm having an issue with AoT build in version 3.0.0
Here is a streamlined code sample
The code is simplified, but those are the only important parts.
In the last step I have to wait for a response from a service, and move the wizard programmatically only if it was successful.
In development, with JiT compiler it works as expected.
In production, with AoT compiler,
this.wizard
is always undefined, and it never moves to the completion step.Any suggestions or workaround?
Thanks
The text was updated successfully, but these errors were encountered: