如何在ng2-ionic-rating模块中添加NO_ERROR_SCHEMAS

时间:2018-08-30 12:44:27

标签: ionic-framework ionic3

我正在使用ng2-ionic-rating插件,但在使用以下命令构建APK时却出现错误 离子科尔多瓦建立android --prod

错误如下所示

   'rating' is not a known element: 1. If 'rating' is an Angular component, 
    then verify that it is part of this
        module. 2. To allow any element add 'NO_ERRORS_SCHEMA' to the 
   '@NgModule.schemas' of this component. ("
        <ion-card padding> <h1>Rate this App</h1> [ERROR ->]<rating 
    [(ngModel)]="rate" max="5"
        emptyStarIconName="star-outline" halfStarIconName="star-half" ")

html代码是

      <ion-header>
     <ion-navbar>
       <ion-title>
     Ionic Blank
       </ion-title>
     </ion-navbar>
   </ion-header>
  <ion-content>
  <ion-card padding>
    <h1>Rate this App</h1>
     <rating [(ngModel)]="rate" max="5" emptyStarIconName="star-outline"  
      halfStarIconName="star-half"     starIconName="star"  nullable="false"  
     (ngModelChange)="onModelChange($event)">
   </rating>

   <ion-input [(ngModel)]="reason" placeholder="Please Give your reason">
    </ion-input>
      <button ion-button small round 
      (click)="resolveRec()">Feedback</button>
    </ion-card>

  </ion-content>

1 个答案:

答案 0 :(得分:1)

您应将Ionic2RatingModule添加到imports中的app.module.ts数组中。 如果再次遇到相同的错误,则原因是不支持Ionic2RatingModule的版本。尝试将Ionic2RatingModule的版本降级为矿机版本。

工作Example