我正在尝试绑定一个简单的选择或一个离子选择,但是现在,它只是不起作用...
我已经在模块和页面中导入了FormsModule:
import { FormsModule } from '@angular/forms';
但仍然出现相同的错误:
Can't bind to 'ngModel' since it isn't a known property of 'ion-select'.
这是视图:
<ion-list>
<ion-list-header>Choix du jeu</ion-list-header>
<ion-item>
<ion-label>Mode de jeu</ion-label>
<ion-select [(ngModel)]="gameMode" placeholder="choix...">
<ion-select-option *ngFor="let s of games" value="{{s}}">{{s}}</ion-select-option>
</ion-select>
</ion-item>
</ion-list>
(ngFor正在工作)
我的module.ts文件:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import { IonicStorageModule } from '@ionic/storage';
import { FormsModule } from '@angular/forms';
import {ScoreModalComponent} from './score-modal/score-modal.component'
@NgModule({
declarations: [AppComponent, ScoreModalComponent],
entryComponents: [ScoreModalComponent],
imports: [BrowserModule,
IonicModule.forRoot(),
IonicStorageModule.forRoot(),
AppRoutingModule,
FormsModule
],
providers: [
StatusBar,
SplashScreen,
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
],
bootstrap: [AppComponent]
})
export class AppModule {}
谢谢!
答案 0 :(得分:0)
在离子列表文档中,没有任何双向绑定。但是有事件绑定(click)