Mat-Angular-Stepper how to go to the next step through typescript?

Asked

Viewed 121 times

-2

I’m trying to give the next through a function.

I saw in the documentation that they possess the method next()

But I tried to stop both the matStepper as to the matStepperHorizontal in my constructor but I get:

ERROR Error: Uncaught (in Promise): Error: Staticinjectorerror(Appmodule)[Matformfield -> Changedetectorref]:
Staticinjectorerror(Platform: core)[Matformfield -> Changedetectorref]: Nullinjectorerror: No Provider for Changedetectorref!

I can’t place this service in my app module...

  • Put your code so we can help

  • Shows what you’ve done.

  • Already got it. I added in response to my resolution guys

1 answer

0


I was able to add the following local variable #stepper:

<mat-horizontal-stepper [linear]="isLinear" #stepper>

And then on my form, on onsubmit I passed Stepper as parameter:

<form (onSubmit)="eventoSubmit(stepper)">

And then in my function eventoSubmit:

eventoSubmit(stepper: MatStepper){
   stepper.next()
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.