不能绑定到' ngModel'因为它不是' ion-select'的已知属性,

问题描述:

大家好,当我在产品发布版中编译我的应用程序时,我遇到了一个错误

Hello everyone when i'm compile my app in prod release i got an error

由于它不是'ion-select'的已知属性,因此无法绑定到'ngModel'.

Can't bind to 'ngModel' since it isn't a known property of 'ion-select'.

我的代码

<ion-select #sel1  [(ngModel)]="Selectedcat" (ngModelChange)="onChange()" >

我在appmodule中进行此配置:

i make this configuration in appmodule :

imports: [
 BrowserModule,
 HttpModule,
 Ionic2RatingModule ,
 FormsModule,
 IonicModule.forRoot(MyApp),
 IonicStorageModule.forRoot(),
 IonicImageLoader.forRoot()
 ]

感谢您的帮助

您需要将此添加到组件模块中

You need to add this to components modules

import { IonicModule } from '@ionic/angular';
import { FormsModule } from '@angular/forms';

@NgModule({
 imports: [
  IonicModule,
  FormsModule
 ];
})