question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:5
  • Comments:11

github_iconTop GitHub Comments

1reaction
Manbeccommented, Jan 19, 2019

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

0reactions
Xstream007commented, Oct 6, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

NG0201: No provider for {token} found! - Angular
You see this error when you try to inject a service but have not declared a corresponding provider. A provider is a mapping...
Read more >
Angular no provider for NameService - Stack Overflow
I have tried adding a service in app.module.shared.ts in @NgModule section : providers: [DataManagerService] but still get the error : Error: No provider...
Read more >
Angular Error: "No Provider for Module..." - Blog Post
The error "No Provider for Module" is a common mistake when first starting out, especially using your own custom services.
Read more >
I was getting "Error: No provider for t" during AoT compilation ...
I was getting "Error: No provider for t" during AoT compilation and found out that was happening because I had constructor( translate: ...
Read more >
How to fix angular error main.js:1 NullInjectorError
How to fix angular error main.js:1 NullInjectorError: No provider for i! ... You need to add the service under "providers" in your app.module.ts...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found