Closed vladostsk92 closed 5 years ago
Can i see your appModule.ts file and your childModule.ts file?
Yes you do not need the .forRoot() option anymore. If your childModule is using the datetimepopup, then you need to use the datetimepopupmodule in that place only....
Also what version of angular and ngxBootstrap are you using?
"@angular/core": "~7.2.0", "@ng-bootstrap/ng-bootstrap": "^4.1.3",
CHILD-MODULE
import { NgModule } from '@angular/core';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { CountersComponent } from './pages/counters/counters.component';
import { FormsModule } from '@angular/forms';
import { DatetimePopupModule } from 'ngx-bootstrap-datetime-popup';
@NgModule({
imports: [
NgbModule,
FormsModule,
DatetimePopupModule,
],
declarations: [
CountersComponent,
]
})
export class CountersModule { }
MAIN-MODULE
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { UpgradeModule } from '@angular/upgrade/static';
import { AppComponent } from './app.component';
import { CountersModule } from './counters/counters.module';
import { CommonModule } from '@angular/common';
@NgModule({
imports: [
BrowserModule,
UpgradeModule,
CommonModule,
CountersModule,
],
bootstrap: [AppComponent],
declarations: [
AppComponent,
],
exports: [
CommonModule
]
})
export class AppModule {
constructor() {}
}
Your using ng-bootstrap
not ngx-bootstrap
??
Your using https://github.com/ng-bootstrap/ng-bootstrap My component uses https://github.com/valor-software/ngx-bootstrap
Also what version of datetimepopup are you referencing in your package.json file?
"ngx-bootstrap-datetime-popup": "^4.0.1",
may i use ngx-bootstrap 3? not 4
I believe you need to use 4, try and see though if you get error with 3, but if i remember correctly you will
I install ngx-bootstrap 4.2.0 , but it did not solve the problem, still "No provider for ComponentLoaderFactory!"
Any chance u can create a plunkr to replicate this?
I will look at this as soon as i can, maybe in a day though as just done a massive server upgrade.
On Mon, May 27, 2019 at 4:43 AM vladostsk92 notifications@github.com wrote:
Yes. sure
https://stackblitz.com/edit/angular-hx565x
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Gillardo/ngx-bootstrap-datetime-popup/issues/19?email_source=notifications&email_token=ABYQGLPO46CWR55B3KXXKITPXNKGFA5CNFSM4HPOUQJ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWIWJTY#issuecomment-496067791, or mute the thread https://github.com/notifications/unsubscribe-auth/ABYQGLMQOGFKHXPPZYOPQNTPXNKGFANCNFSM4HPOUQJQ .
Hello, I have the same issue as @vladostsk92. I'm using ngx-bootstrap v4.0.3. So, have you had time to look this issue ?
Thanks
Sorry guys, i been very busy lately. I have no idea why this is working in my project at work, but not for you. I have re-added the forRoot() method in verison 4.1.0. Can you try this and let me know if this is ok please?
I am publishing it in npm now
this seems to break my code completely, so i have no idea what the fook is going on
can you please confirm if this fixes your code, else i will revert
Guys, think i have actually fixed this now!! Can you try and install version 4.2.0. This imports the ComponentLoaderFactory into this component which it must of been separately from a module in previously releases of ngx-bootstrap
Final update on this matter guys, use 4.3.0 This reintroduces the .forRoot()' method again. You also need to import the 'DatepickerModule', 'TimepickerModule' and 'BsDropdownModule' into your
app.module.ts` file.
I have updated the readme file accordingly
Thank you, for your time. it works for me!!!
I am sorry it took a while, been very snowed under. Glad its working for you now
Still facing the same issue.......
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { CreateTournamentComponent } from './component/create-tournament/create-tournament.component';
import { UserRecordComponent } from './component/user-record/user-record.component';
import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
import { DatepickerModule } from 'ngx-bootstrap/datepicker';
import { TimepickerModule } from 'ngx-bootstrap/timepicker';
import { DatetimePopupModule } from 'ngx-bootstrap-datetime-popup';
@NgModule({
declarations: [
AppComponent,
CreateTournamentComponent,
UserRecordComponent
],
imports: [
BrowserModule,
HttpModule,
HttpClientModule,
AppRoutingModule,
FormsModule,
ReactiveFormsModule,
BsDatepickerModule.forRoot(),
BrowserAnimationsModule,
ModalModule.forRoot(),
BsDropdownModule.forRoot(),
DatepickerModule.forRoot(),
TimepickerModule.forRoot(),
DatetimePopupModule.forRoot()
],
bootstrap: [AppComponent]
})
export class AppModule { }
Uncaught (in promise): NullInjectorError: StaticInjectorError(AppModule)[BsDropdownDirective -> ComponentLoaderFactory]: StaticInjectorError(Platform: core)[BsDropdownDirective -> ComponentLoaderFactory]: NullInjectorError: No provider for ComponentLoaderFactory! NullInjectorError: StaticInjectorError(AppModule)[BsDropdownDirective -> ComponentLoaderFactory]: StaticInjectorError(Platform: core)[BsDropdownDirective -> ComponentLoaderFactory]: NullInjectorError: No provider for ComponentLoaderFactory!
i have followed the same steps as mentioned in the docs but got the same issue.
Can u please look into this.
@vladostsk92 can u tell me how u done this
Hello, im facing this issue. Im using the versions as suggested :
my app.module :
import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { AngularFontAwesomeModule } from 'angular-font-awesome'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { MaterialModules } from './shared/material.module'; import { HeaderComponent } from './header/header.component'; import { HomeComponent } from './home/home.component'; import { CatalogComponent } from './catalog/catalog.component'; import { SidenavComponent } from './sidenav/sidenav.component'; import { HttpClientModule } from '@angular/common/http'; import { CategoryComponent } from './category/category.component'; import { FormsModule } from '@angular/forms'; import { BsDropdownModule } from 'ngx-bootstrap/dropdown'; import { DatepickerModule } from 'ngx-bootstrap/datepicker'; import { TimepickerModule } from 'ngx-bootstrap/timepicker'; import { DatetimePopupModule } from 'ngx-bootstrap-datetime-popup'; @NgModule({ declarations: [ AppComponent, HeaderComponent, HomeComponent, CatalogComponent, SidenavComponent, CategoryComponent ], imports: [ HttpClientModule, BrowserModule, AppRoutingModule, BrowserAnimationsModule, MaterialModules, AngularFontAwesomeModule, FormsModule, BsDropdownModule.forRoot(), DatepickerModule.forRoot(), TimepickerModule.forRoot(), DatetimePopupModule.forRoot() ], providers: [], bootstrap: [AppComponent] }) export class AppModule { }
my html :
<datetime-popup [(value)]="myDate"></datetime-popup>
my error :
core.js:15724 ERROR Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[BsDropdownDirective -> ComponentLoaderFactory]: StaticInjectorError(Platform: core)[BsDropdownDirective -> ComponentLoaderFactory]: NullInjectorError: No provider for ComponentLoaderFactory! Error: StaticInjectorError(AppModule)[BsDropdownDirective -> ComponentLoaderFactory]: StaticInjectorError(Platform: core)[BsDropdownDirective -> ComponentLoaderFactory]: NullInjectorError: No provider for ComponentLoaderFactory! at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector
Upgrade to latest version 4.4.0 should be fine
I had this problem with the latest version first , then downgraded it to use the same as suggested.
This seems to be working fine for me and also in the demo project. Can u recreate it in a plunkr or something for me to see?
Hello, Error: StaticInjectorError(AppModule)[BsDropdownDirective -> ComponentLoaderFactory]: StaticInjectorError(Platform: core)[BsDropdownDirective -> ComponentLoaderFactory]: NullInjectorError: No provider for ComponentLoaderFactory!
I have main appModule with import childModule. In childModule: import { DatetimePopupModule } from 'ngx-bootstrap-datetime-popup'; imports: [... , DatetimePopupModule, ...]
I see you removed ".forRoot()", what needs to be done now?