简体   繁体   中英

IOnic angular prod compiler error Property 'md' does not exist on type

Hi for the following code

<ion-segment value="{{selectedWor}}" (ionChange)="worshipTypeChanged($event)" [mode]="md">

I am getting the following error when i run: ionic build --prod. (no compiler error without --prod)

 ERROR in src/app/pages/map/map.html(38,85): Property 'md' does not exist on type 'MapPage'. [ERROR] An error occurred while running subprocess ng. ng.cmd run app:build:production exited with exit code 1. Re-running this command with the --verbose flag may provide more information.

Any ideas? The documentation says i can do it..

Here is my ionic info.

Ionic:

Ionic CLI : 5.4.6 (C:\\Users\\ginil\\AppData\\Roaming\\npm\\node_modules\\ionic) Ionic Framework : @ionic/angular 5.0.4
@angular-devkit/build-angular : 0.803.24 @angular-devkit/schematics : 8.3.20 @angular/cli : 8.3.20
@ionic/angular-toolkit : 2.2.0

Cordova:

Cordova CLI : 8.1.2 (cordova-lib@8.1.1) Cordova Platforms : not available Cordova Plugins : not available

Utility:

cordova-res : 0.5.1 native-run : 0.2.7

System:

NodeJS : v11.11.0 (C:\\Program Files\\nodejs\\node.exe) npm : 6.7.0 OS : Windows 10

You are using mode as two way binding variable so you have to declare md in ts file.

There are two way to use mode property

1)

<ion-segment value="{{selectedWor}}" (ionChange)="worshipTypeChanged($event)" mode="md">

2)

html

<ion-segment value="{{selectedWor}}" (ionChange)="worshipTypeChanged($event)" [mode]="md">

ts

md = 'md'

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