@ViewChild(WizardComponent) not working with AOT build
See original GitHub issueHi,
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:
- Created 5 years ago
- Reactions:3
- Comments:9 (6 by maintainers)
Top GitHub Comments
ID References are working
@ViewChild('wizard') wizard: WizardComponent;
<aw-wizard #wizard disableNavigationBar="true" navigationMode="free">...
I’ve just released
angular-archwizard
version4.0.0
to npm! Feel free to give it a try!