Skip to content
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

Programmatically navigation #352

Open
roydekleijn opened this issue Jul 18, 2021 · 4 comments
Open

Programmatically navigation #352

roydekleijn opened this issue Jul 18, 2021 · 4 comments

Comments

@roydekleijn
Copy link

roydekleijn commented Jul 18, 2021

Hello,

I want to programmatically navigate to the next step of the wizard. (eventually, I like to do that with query parameters, but first things first)

Template:

<aw-wizard #wizard [navBarLayout]="'large-filled-symbols'">

In this template I have code to navigate to the next page.

@Component({
  selector: 'app-checkout',
  templateUrl: './checkout.component.html',
  styleUrls: ['./checkout.component.css']
})
export class CheckoutComponent implements OnInit {

  @ViewChild('wizard') wizard: WizardComponent;

  constructor() {
  }

  next(): void {
    this.wizard.goToStep(2);
  }

}

When pressing the button, nothing happens. I use version 7.0.0

How can I programmatically navigate to the next step ?

I printed the wizard object:

image

@roydekleijn
Copy link
Author

omg, I didn't notice before... but it's a zero based index :) sorry!

@roydekleijn
Copy link
Author

roydekleijn commented Jul 18, 2021

One more thing,

If I call this code in the ngOnInit:

this.wizard.navigation.goToStep(this.wizard, 1);

Then I get this error:

ERROR TypeError: Cannot read property 'navigation' of undefined

How can I solve this one ?

If I implement the code in ngAfterViewInit, then I get:

core.js:6456 ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'exit' of null
TypeError: Cannot read property 'exit' of null

@roydekleijn roydekleijn reopened this Jul 18, 2021
@madoar
Copy link
Owner

madoar commented Jul 18, 2021

Do you have a short example project showcasing the issue?
This would help me tremendously finding the reason for the issue :)

@roydekleijn
Copy link
Author

Awesome, defaultStepIndex helped me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants