Alberplz / angular2-color-picker

Angular 2 Color Picker Directive, no dependences required.
MIT License
185 stars 82 forks source link

colorPickerChange fired on initialization. #78

Open avoliva opened 7 years ago

avoliva commented 7 years ago

The colorPickerChange event is being fired on initialization.

iEricKoh commented 7 years ago

@avoliva I got the same problem, any solutions?

chendachao commented 7 years ago

+1

nrigaudiere commented 7 years ago

+1

nrigaudiere commented 7 years ago

@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;
  }
}
avoliva commented 7 years ago

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

sscots commented 7 years ago

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

chrisbenseler commented 7 years ago

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