简体   繁体   中英

Ionic error while trying to import DatePicker into app.module.ts

I am having a problem with some providers in my app.module.ts file. For example, I am using DatePicker and it is giving me this error:

Type 'DatePickerOriginal' is not assignable to type 'Provider'.
  Type 'DatePickerOriginal' is missing the following properties from type 'FactoryProvider': provide, useFactoryts(2322)

Here is how I am importing it:

import { DatePicker } from '@ionic-native/date-picker/ngx';

Ionic:

Ionic CLI: 5.4.16 Ionic Framework: ionic-angular 3.9.10 @ionic/app-scripts: 3.2.4

Cordova:

Cordova CLI: 8.1.2 (cordova-lib@8.1.1) Cordova Platforms: ios 4.5.5 Cordova Plugins: cordova-plugin-ionic-keyboard 2.2.0, (and 19 other plugins)

Utility:

cordova-res: not installed native-run: not installed

System:

NodeJS: v14.15.4 (/usr/local/bin/node) npm: 6.14.10 OS: macOS Catalina

Using the solutions above, here is what worked:

To each Ionic plugin on EACH page, I added '/ngx' to the end. For good measure, I deleted the package-lock.json file. I then installed the date-picker using the command from above. That seemed to work

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