将angular2与新的角度材质和第三方指令angular2-color-picker一起使用会引发错误:
"can't bind to 'colorPicker' since it isn't a known property"
答案 0 :(得分:0)
:必须在MaterialModule之前包含ColorPickerModule。这就是诀窍。
答案 1 :(得分:0)
在您的基本模块文件(app.module.ts或类似文件)中添加以下行
import {ColorPickerModule} from 'angular2-color-picker';
在你的NgModule内的同一个文件中添加ColorPickerModule部分就是这样的。这将有效。
从'angular2-color-picker'导入{ColorPickerModule};
@NgModule({
imports: [
ColorPickerModule,
.........,
.........
],
declarations: [
........,
........
],
providers: [
........,
.........
],
bootstrap: [ AppComponent ]
})
export class AppModule { }
答案 2 :(得分:-1)
尝试在app.module.ts
中导入它import {...} from '..';
import {ColorPickerModule} from 'angular2-color-picker'; //SEE THIS
@NgModule({
declarations: [
...
],
imports: [
ColorPickerModule,//SEE THIS
...
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {}