We are using the DatePicker and TimePicker within our Dynamic Form renderer @ https://form.io in the repo @ https://github.com/formio/ng2-formio.
We are having an issue dynamically creating the DatePicker due to the way you are exporting your modules using the non-standard forRoot method. Here is an example of what we are doing..
import { NgModule, Compiler, Component, ComponentFactory } from '@angular/core';
import { DatepickerModule, TimepickerModule } from 'ng2-bootstrap';
@NgModule({
imports: [
DatepickerModule.forRoot(),
TimepickerModule.forRoot()
]
})
class DynamicComponentModule {}
...
compiler.compileModuleAndAllComponentsAsync(DynamicComponentModule)
It seems that the structure that you return within forRoot is not expected for dynamic module creation and causes an error.
you can reconstruct it as static module https://github.com/valor-software/ng2-bootstrap/blob/development/src/datepicker/datepicker.module.ts
and is more or less standard
https://angular.io/docs/ts/latest/guide/ngmodule.html#!#core-for-root
I am afraid it is @angular issue, try to create one
Thanks for the feedback. I was unaware of that construct. I will submit an issue with @angular.
Thanks again.
np :) just link this issue, so I could track progress, give me a note if you will need something
Here is the bug report into @angular.
https://github.com/angular/angular/issues/14022
Thanks again for your help.
I had same issue with Progressbar module: No provider for ProgressbarConfig! and I didn't call .forRoot() in my lazy loaded module. I was thinking it would just work when I import it in lazy loaded module.
UPDATE: Basically by adding ProgressbarModule to imports array in app.module with .forRoot() and in lazy loaded module without .forRoot() solved my problem.
I thought only adding it in app.module would suffice, but no, it's also required to be added in lazy loaded module .
@travist seems it is fixed, drop me a note if not ;)
Most helpful comment
I had same issue with Progressbar module:
No provider for ProgressbarConfig!and I didn't call.forRoot()in my lazy loaded module. I was thinking it would just work when I import it in lazy loaded module.UPDATE: Basically by adding ProgressbarModule to
importsarray inapp.modulewith.forRoot()and in lazy loaded module without.forRoot()solved my problem.I thought only adding it in app.module would suffice, but no, it's also required to be added in lazy loaded module .