我按照GitHub上的使用指南加載所有內容,但是我得到這個錯誤「錯誤:模塊AppModule
導入了意想不到的值ColorPickerModule
」。Angular 2 cli:如何加載顏色選擇器?沒有system.config.js了?
https://github.com/Alberplz/angular2-color-picker
這是我迄今爲止
app.module.ts
import {ColorPickerModule} from 'angular2-color-picker';
imports: [ColorPickerModule]
工具欄組件
import {ColorPickerService} from 'angular2-color-picker';
@Component({
selector: 'app-toolbar',
templateUrl: './toolbar.component.html',
styleUrls: ['./toolbar.component.scss'],
providers: [ColorPickerService]
})
export class ToolbarComponent implements OnInit {
constructor(private cpService: ColorPickerService) { }
ngOnInit() {}
}
工具欄模板
<input [(colorPicker)]="color" [style.background]="color" [value]="color"/>
聽說system.config.js不再使用,但我不是100%肯定。我如何正確加載顏色選擇器?
您應該在聲明組件的模塊中導入ColorPickerModule – Fals