Open cstslqq opened 5 years ago
我在 Angular5
上面使用当前的依赖包也存在上面的问题。我把源码下载下来做如下小小修改就可以 跑了
解决办法:
const injector = ReflectiveInjector.fromResolvedProviders([], this.vcRef.parentInjector);
为 const injector = Injector.create([], this.vcRef.parentInjector);
3.使用,如果你把 color-picker
放到 shareModule
,需要做如下处理:
//share.module.ts
@NgModule({ imports:[ColorPickerModule], exports:[ColorPickerModule] }) export class SharedModule { ... }
<span class="c-color-picker" [(colorPicker)]="color" [style.background]="color">
I'm
Angular5
using the current dependencies on top of the above problems also exist. I downloaded the source code and made the following small modifications to run. Solution:
- Find the color-picker.directive.ts file
- Modify the injector
const injector = ReflectiveInjector.fromResolvedProviders([], this.vcRef.parentInjector);
toconst injector = Injector.create([], this.vcRef.parentInjector);
- Use, if you put
color-picker
intoshareModule
, needs to be handled as follows://share.module.ts @NgModule({ imports:[ColorPickerModule], exports:[ColorPickerModule] }) export class SharedModule { ... } <span class="c-color-picker" [(colorPicker)]="color" [style.background]="color"></span>
I couldn't find Injector create in angular/core. Can share how it works?
ERROR in node_modules/angular2-color-picker/node_modules/rxjs/Subject.d.ts(24,5): error TS2416: Property 'lift' in type 'Subject' is not assignable to the same property in base type 'Observable'.
Type '(operator: Operator<T, R>) => Observable' is not assignable to type '(operator: Operator<T, R>) => Observable'.
Type 'Observable' is not assignable to type 'Observable'.
Type 'T' is not assignable to type 'R'.