简体   繁体   中英

Nebular Time Picker throwing 'nb-timepicker' is not a known element?

I'm trying to implement nebular TimePicker component in my Angular 8 project, and I followed the Nebular Documentation mentioned here:

https://akveo.github.io/nebular/docs/components/timepicker

But they didn't mention How can I import timepicker module into my project?, I tried this

import 'NbTimepickerModule' from '@nebular/theme';

but this error raised:

Module "../../node_modules/@nebular/theme" has no exported member 'NbTimepickerModule'. Did you mean 'NbDatepickerModule'?

Thanks in advance

First you must import it in your module :

import {NbTimepickerModule } from "@nebular/theme";
@NgModule({
  imports: [
    // ...
    NbTimepickerModule,
  ],
})

Second add the NbTimepickerModule.forRoot() to your module too :

@NgModule({
  imports: [
    // ...
    NbTimepickerModule.forRoot(),
  ],
})

for more details this is the link you need : https://akveo.github.io/nebular/docs/components/timepicker/overview#nbtimepickerdirective

Timepicker is not part of all nebular version.

Nebular Changelog

Timepicker is only available on v6.1+.

Extra

Your imports should look like this

//app.module
import { NbTimepickerModule } from '@nebular/theme';
...
imports: [
  ...
  NbTimepickerModule.forRoot(),
],
...

//your submodule.module
import { NbTimepickerModule } from '@nebular/theme';
...
imports: [
  ...
  NbTimepickerModule;
],
...

The datetime-picker wasn't available in nebular 6.0.0. I updated to 7.0.0 and everything is working fine.

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