No provider
See original GitHub issueHello, 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.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:11
Top GitHub Comments
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
Please refer the given link for Angular 9 and above:- DanielMoncada/Angular-datetime-picker