Estoy creando un calendario personalizado y extend desde NbCalendarDayCellComponent<Date> . Necesito inyectar otros servicios a mi customCellComponent, pero si lo hago, necesito inyectar NbDateService y recibo el siguiente error:
ERROR NullInjectorError: R3InjectorError(AppModule)[NbDateService -> NbDateService -> NbDateService]: NullInjectorError: No hay proveedor para NbDateService
Intenté agregar diferentes módulos y no funcionó.
En su app.module.ts agregue:
// ... import { NbDatepickerModule } from '@nebular/theme'; // ... @NgModule({ //... imports: [ NbDatepickerModule, ], //... }) Luego, en su CustomCellDayComponent funcionará esto:
export class CustomCellDayComponent extends NbCalendarDayCellComponent<Date> implements OnInit, OnDestroy { constructor(public nbDateService: NbDateService<Date>,){ super(nbDateService); } }Puede intentar agregar un proveedor NbDateService en App.module.ts
@NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, AppRoutingModule, NgxGenericTableModule, BrowserAnimationsModule ], providers: [ NbDateService // Add provider in your app.module ], bootstrap: [AppComponent] })