Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

Ion-toggle submits form

$
0
0

@Daskus wrote:

I have the following simple code:

@Page({
    template: `
      <ion-content>
        <form (submit)="submit()">
          <ion-item>
              <ion-label>Some Toggle</ion-label>
              <ion-toggle [(ngModel)]="toggle"></ion-toggle>
          </ion-item>

          <div *ngIf="toggle">some content 1</div>
          <div *ngIf="!toggle">some content 2</div>

            <button type="submit">Submit</button>
        </form>
      </ion-content>
    `,
})
export class TestPage{

  submit(){
    console.log("form submit");
  }
}

The problem is that whenever I click on the toggle the form calls the submit function.

Does anyone have a solution to this problem?

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>