owsolutions / amazing-time-picker

Timepicker (Clock Picker) for Angular 2, Angular 4 and Angular 5, Angular 6, Angular 7 - Compatible with Angular Material
137 stars 76 forks source link

Picker used from within Angular Material dialog causes Injector error #123

Open michael-lang opened 5 years ago

michael-lang commented 5 years ago

Using the time picker from a form inside of a dialog results in the dialog not opening properly (appearing empty to the side, as if it wasn't an entry component), and with the following console error.

I've tried two variations. One it using the atp-time-picker directive on the input control. The other is no directive on the control and just injecting the AmazingTimePickerService in the components constructor. Not even using the injected service still causes the exception below.

some possible related console warnings...

client:148 [WDS] Warnings while compiling.
warnings @ client:148
client:154 ./node_modules/amazing-time-picker/node_modules/@angular/core/fesm5/core.js 18261:15-36
Critical dependency: the request of a dependency is an expression
warnings @ client:154
client:154 ./node_modules/amazing-time-picker/node_modules/@angular/core/fesm5/core.js 18273:15-102
Critical dependency: the request of a dependency is an expression
warnings @ client:154

the console error

ng:///AdminModule/AdvisoryFormComponent_Host.ngfactory.js:5 
ERROR Error: StaticInjectorError(AppModule)[AmazingTimePickerService -> ComponentFactoryResolver]: 
  StaticInjectorError(Platform: core)[AmazingTimePickerService -> ComponentFactoryResolver]: 
    NullInjectorError: No provider for ComponentFactoryResolver!
    at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (core.js:3228)
    at resolveToken (core.js:3473)
    at tryResolveToken (core.js:3417)
    at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:3314)
    at resolveToken (core.js:3473)
    at tryResolveToken (core.js:3417)
    at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:3314)
    at resolveNgModuleDep (core.js:19784)
    at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (core.js:20473)
    at resolveNgModuleDep (core.js:19784)
michael-lang commented 5 years ago

I tried to create a stackblitz to reproduce, but it works. There must be something else I am doing that complicates the solution.

Here is a simple stackblitz that works https://stackblitz.com/edit/angular-hq4dxn

valecj commented 5 years ago

x2