Alberplz / angular2-color-picker

Angular 2 Color Picker Directive, no dependences required.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ERROR in node_modules/angular2-color-picker/node_modules/rxjs/Subject.d.ts(24,5):

cstslqq opened this issue · comments

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'.

我在 Angular5 上面使用当前的依赖包也存在上面的问题。我把源码下载下来做如下小小修改就可以 跑了
解决办法:

  1. 找到 color-picker.directive.ts 文件
  2. 修改注入器 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"></span>

I'm Angular5using 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:

  1. Find the color-picker.directive.ts file
  2. Modify the injector const injector = ReflectiveInjector.fromResolvedProviders([], this.vcRef.parentInjector); to const injector = Injector.create([], this.vcRef.parentInjector);
    3. Use, if you put color-pickerinto shareModule, 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?