DanielYKPan / date-time-picker

Angular Date Time Picker (Responsive Design)
https://daniel-projects.firebaseapp.com/owlng/date-time-picker
MIT License
563 stars 358 forks source link

No provider #520

Open Dedme opened 6 years ago

Dedme commented 6 years ago

Hello, i am getting "ERROR Error: OwlDateTimePicker: No provider found for DateTimePicker. You must import one of the following modules at your application root: OwlNativeDateTimeModule, OwlMomentDateTimeModule, or provide a custom implementation."

When i navigate to a form that has the control configured. I recently updated from Angular 6 to Angular 7, i have updated package.json to "ng-pick-datetime": "^7.0.0", "ng-pick-datetime-moment": "^1.0.8"

i previously had all a shared module configured as such:

export const MY_NATIVE_FORMATS = {
  fullPickerInput: 'DD MMM YYYY hh:mm',
  datePickerInput: 'DD MMM YYYY',
  timePickerInput: 'hh:mm',
  monthYearLabel: 'MMM YYYY',
  dateA11yLabel: 'DD MMM YYYY',
  monthYearA11yLabel: 'MMM YYYY',
};

@NgModule({
  imports: [
    OwlDateTimeModule,
    OwlMomentDateTimeModule,
  ],
  providers: [{provide: OWL_DATE_TIME_FORMATS, useValue: MY_NATIVE_FORMATS}],
  declarations: [],
  exports: [OwlDateTimeModule, OwlMomentDateTimeModule]
})
export class SharedModule { }

this would be imported into my AppModule. since updating i got the error above, but i have since tried putting this same code into various places. AppModule Only: got error in my other modules that it couldn't find it. AppModule as well: error as above. All Modules: error as above.

Dedme commented 6 years ago

i have rolled back to 1.0.7 for "ng-pick-datetime-moment" and its working correctly now.

LukeHartcher commented 6 years ago

Also getting the same error, reverting to 1.0.7 as described above works..

mstawick commented 6 years ago

Same behaviour with 1.0.8

Manbec commented 5 years ago

Just like you, I recently updated and just need OwlMomentDateTimeModule which used to work fine.

Turns out I was importing: import {OwlMomentDateTimeModule} from 'ng-pick-datetime-moment';

Now it should be: import {OwlMomentDateTimeModule} from 'ng-pick-datetime/date-time/adapter/moment-adapter/moment-date-time.module';

Hope it helps :)

PS: Now you can remove 'ng-pick-datetime-moment' from your package.json

JoshuaAlzate commented 5 years ago

Just like you, I recently updated and just need OwlMomentDateTimeModule which used to work fine.

Turns out I was importing: import {OwlMomentDateTimeModule} from 'ng-pick-datetime-moment';

Now it should be: import {OwlMomentDateTimeModule} from 'ng-pick-datetime/date-time/adapter/moment-adapter/moment-date-time.module';

Hope it helps :)

PS: Now you can remove 'ng-pick-datetime-moment' from your package.json

This solution does not solve the problem. Is there any fix for this?

Manbec commented 5 years ago

My comment is from January. I see commits named Angular 8 from 2 months ago. Do you have them updated? For me I had to implement a custom solution as I needed a time picker right away.

hijamoya commented 4 years ago

This solution does not work in current master with angular8...

tiagovbarreto commented 4 years ago

Hi, I am using angular 6 and facing the same problem. Unfortunatly it is not possible to change the version of angular to support OwlMomentDateTimeModule.

Anyone could provide an example with OwlDateTimeModule?

Thank you in advance.

Lkirankota commented 4 years ago

This solution does not work in current master with angular8...

yes its fails in angular 8 in angular 7 it working fine.

hocine15 commented 4 years ago

The use of:

import {OwlMomentDateTimeModule} from 'ng-pick-datetime/date-time/adapter/moment-adapter/moment-date-time.module';

is not working in angular 9:

Message:

ERROR in node_modules/ng-pick-datetime/date-time/adapter/moment-adapter/moment-date-time.module.d.ts:3:22 - error NG6002: Appears in the NgModule.imports of MyComponentModule, but could not be resolved to an NgModule class.

This likely means that the library (ng-pick-datetime/date-time/adapter/moment-adapter/moment-date-time.module) which declares OwlMomentDateTimeModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

Xstream007 commented 4 years ago

Please refer the given link for Angular 9 and above:- DanielMoncada/Angular-datetime-picker

NaveenKumar24 commented 11 months ago

The use of:

import {OwlMomentDateTimeModule} from 'ng-pick-datetime/date-time/adapter/moment-adapter/moment-date-time.module';

is not working in angular 9:

Message:

ERROR in node_modules/ng-pick-datetime/date-time/adapter/moment-adapter/moment-date-time.module.d.ts:3:22 - error NG6002: Appears in the NgModule.imports of MyComponentModule, but could not be resolved to an NgModule class.

This likely means that the library (ng-pick-datetime/date-time/adapter/moment-adapter/moment-date-time.module) which declares OwlMomentDateTimeModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

I am migrate Angular 8.2.14 to 9.1.13 also facing same issue. How to fix?