我想在离子2中使用颜色选择器。我使用了来自here的angular2-color-picker。根据doc文件夹添加页面/颜色选择器。请帮我一些遗漏或我该怎么办?
获取错误
没有ColorPickerService的提供者!
My.html
<ion-input [(colorPicker)]="color" [style.background]="color" [value]="color"></ion-input>
my.ts
import {ColorPickerDirective} from '../color-picker/color-picker.directive'
@Component({
templateUrl: 'build/pages/trans-generation/trans-generation.html',
directives: [ColorPickerDirective]
})
export class TransGeneration {
private color: string = "#127bdc";
}
app.ts
import {TransGeneration} from './pages/trans-generation/trans-generation';
import {ColorPickerService} from './pages/color-picker/color-picker.service'
ionicBootstrap(MyApp,TransGeneration, [ColorPickerService])
答案 0 :(得分:1)
在app.module.ts文件中导入ColorPickerModule行,它应该可以正常工作。
import {ColorPickerModule} from 'angular2-color-picker';
@NgModule({
...
imports: [ColorPickerModule]
})