sridharan
sridharan

Reputation: 2065

Angular2 ionic 2 Color picker

i want to use a color picker in ionic 2 . I using angular2-color-picker From here. as per the doc folder added pages/color-picker. please help me some thing missing or what can i do?

its Get error

No provider for 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])

Upvotes: 1

Views: 1992

Answers (1)

Girish Rathod
Girish Rathod

Reputation: 616

Import ColorPickerModule line in your app.module.ts file it should work fine.

import {ColorPickerModule} from 'angular2-color-picker';

@NgModule({
    ...
    imports: [ColorPickerModule]
})

Upvotes: 1

Related Questions