Navigation going back when send form

I am having a problem with the navigation… I have one page, that navigates to another, using this.nav.push(AnotherPage);

In this “AnotherPage” I have a form:

<form (ngSubmit)="save($event)" [ngFormModel]="form" #mf="ngForm" novalidate>
    <ion-list>
        <ion-item>
            <ion-label floating>Senha antiga</ion-label>
            <ion-input [(ngModel)]="oldPassword" ngControl="oldPassword" type="password" #oldPasswordVar="ngForm"  required>
            </ion-input>
        </ion-item>
        <div [hidden]="oldPasswordVar.pristine || oldPasswordVar.valid" class="alert alert-danger">
            É necessário digitar sua senha atual
        </div>
       <ion-item>
            <ion-label floating>Nova senha</ion-label>
            <ion-input [(ngModel)]="newPassword" ngControl="newPassword" type="password" #newPasswordVar="ngForm"  required>
            </ion-input>
        </ion-item>
        
        <div [hidden]="confirmNewPasswordVar.pristine || confirmNewPasswordVar.valid" class="alert alert-danger">
            É necessário repetir a nova senha
        </div>
         <div [hidden]="!showPasswordDontMatchErrorMessage" class="alert alert-danger">
            A senha não confere
        </div>
    </ion-list>
    <div padding>
        <div class="alert alert-danger alert-main">
                {{errorMessage}}
        </div>
        <button block large nav-pop [disabled]="!mf.form.valid || showProgressBar">Alterar senha</button>
    </div>
</form>

The problem is everytime i click on the button, he navigates back! And I don’t want him to navigate back…

I’m doing something wrong?
How I can do tho submit this form an keed on the same page?

Thanks!

What does the save function look like?

Only this for now:

save(form) {
  console.log("CALLED SAVE")
}

He show this on console, and navigate back automatically… And I don’t want to…

try return false in save method…

didn’t work returning false…(have the same behavior than before)

Ohhhhh I see my mistake! Is the attribute nav-pop on the button… SOLVED

1 Like