question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@ViewChild(WizardComponent) not working with AOT build

See original GitHub issue

Hi,

My application is on Angular 6.0.5 and uses “angular-archwizard”: “^3.0.0”. I am handling wizard navigation in my TypeScript component for which I have a @ViewChild(WizardComponent) public wizard: WizardComponent; reference. This works fine with JIT compilation. However when using --prod flag, I get the following error

ERROR TypeError: Cannot read property ‘wizardSteps’ of undefined at n._next (5.f63f587b095e81c0550f.js:1) at n.__tryOrUnsub (main.ca9874e42cba7c8aa441.js:1) at n.next (main.ca9874e42cba7c8aa441.js:1) at n._next (main.ca9874e42cba7c8aa441.js:1) at n.next (main.ca9874e42cba7c8aa441.js:1) at n._next (main.ca9874e42cba7c8aa441.js:1) at n.next (main.ca9874e42cba7c8aa441.js:1) at n._subscribe (main.ca9874e42cba7c8aa441.js:1) at n.t._trySubscribe (main.ca9874e42cba7c8aa441.js:1) at n._trySubscribe (main.ca9874e42cba7c8aa441.js:1)

This is my code:

this.loadingTopics$.pipe(
      take(1))
      .subscribe(() => {
        this.wizard.wizardSteps.forEach((step, index) => {
          if (index < wizardStep) {
            step.completed = true;
          }
        });
        this.wizard.navigation.goToStep(wizardStep);
      });

this.wizard is undefined.

Kind regards,

Thorsten

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
uluzoxcommented, Jul 3, 2018

ID References are working @ViewChild('wizard') wizard: WizardComponent; <aw-wizard #wizard disableNavigationBar="true" navigationMode="free">...

0reactions
madoarcommented, Mar 10, 2019

I’ve just released angular-archwizard version 4.0.0 to npm! Feel free to give it a try!

Read more comments on GitHub >

github_iconTop Results From Across the Web

ViewChild not find and bundle bigger when compile using AoT
ViewChild aren't find using AoT. After get a 3th party lib support AoT, I succeed to compile with ngc no error on compilation!...
Read more >
ViewChild - Angular
Property decorator that configures a view query. The change detector looks for the first element or the directive matching the selector in the...
Read more >
Component Queries Metadata Appears To Be Broken When ...
UPDATE - 2019-11-17: The @Component() .queries metadata appears to work if the --prod flag is enabled. As such, this works for a production ......
Read more >
Understanding the ViewChild and ViewChildren decorators in ...
We will cover how to use the @ViewChild and @ViewChildren decorators, what their properties do, and how to specify their properties.
Read more >
Angular @ViewChild: In-Depth Explanation (All Features ...
The Angular @ViewChild decorator is one of the first decorators that you ... This decorator has a lot of features: some of them...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found