Alberplz / angular2-color-picker

Angular 2 Color Picker Directive, no dependences required.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

colorPickerChange fired on initialization.

avoliva opened this issue · comments

The colorPickerChange event is being fired on initialization.

commented

@avoliva I got the same problem, any solutions?

@avoliva I have found a quick workaround for the moment. I'm using a boolean initialized at false and in my function I do the following :

public colorPickerChange(color: string) {
  if (this.isColorPickerInit) {
   //do something
  } else {
   this.isColorPickerInit = true;
  }
}

Ya I'm doing something similar to that too, but a real fix would be preferred.

This is actually preventing me from using this package.
I'm running ajax calls using that Output when they select a color, and are running unnecessary ajax calls upon ngOnInit

Same here, still.
This workaround from @nrigaudiere works for a single colorpicket, but this approach doesn't scale if you have multiple pickers.