简体   繁体   中英

Using Radio buttons in Ionic2

I receive the following error when I try to use Radio buttons in ionic2

Error: Error at 
            /Users/xyz/something/.tmp/pages/new-group/new-group-frequency.ngfactory.ts:528:29 
[16:10:25]  Supplied parameters do not match any signature of call target. 
[16:10:25]  ngc failed 
[16:10:25]  ionic-app-script task: "build" 

My template looks like below:

<ion-content padding>

  <form (submit)="onSubmit($event)" [formGroup]="myForm">

    <ion-list radio-group formControlName="langs">

      <ion-item>
        <ion-label>Go</ion-label>
        <ion-radio value="golang" checked="true"></ion-radio>
      </ion-item>

    </ion-list>
  </form>

</ion-content>

The associated typescript file:

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';

import { FormGroup, FormControl } from '@angular/forms';

@Component({
    selector: 'new-group-frequency',
    templateUrl: 'new-group-frequency.html'
})
export class NewGroupFrequency {
    myForm: FormGroup;

    constructor(public _nav:NavController) {
        this.myForm = new FormGroup({
            "langs": new FormControl('')
        });

    }

    onSubmit() {}

}

Can't figure out what the issue is

我唯一看到的是,当您调用(submit)="onSubmit($event)"您正在发送一个参数,但是在方法的声明onSubmit() {}您并未声明事件参数。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM