在Ionic2中使用单选按钮

时间:2016-12-08 21:15:32

标签: angular ionic2

当我尝试在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" 

我的模板如下所示:

<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>

相关的打字稿文件:

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() {}

}

无法弄清楚问题是什么

1 个答案:

答案 0 :(得分:0)

我唯一能看到的是当你调用(submit)="onSubmit($event)"时你发送的是一个参数,但在方法的声明中onSubmit() {}你没有声明事件参数。