angular-bootstrap-colorpicker icon indicating copy to clipboard operation
angular-bootstrap-colorpicker copied to clipboard

colorpicker-closed not fired

Open Lulunx opened this issue 7 years ago • 2 comments

Hi, ( Sorry my english could be bad )

I'm using the colorpicker for a personnal developement, and I've actually a problem.

I want to send a request in a API when the user close the colorpicker ( I don't want to send it when the color change for don't flood the server ).

For that, I used the colorpicker-closed attribute like that

<button class="ui basic green fluid button" colorpicker type="button" colorpicker-size="200" colorpicker-closed="switchColor()" colorpicker-position="top" ng-model="color.color">Couleur</button>

The function switchColor(), is actually doing only a console.log() ( For debug ! )

$scope.switchColor=function(){ console.log('Test') }

But the close event is never triggered. If someone could help me ?

Thanks Lucas

Lulunx avatar Sep 27 '17 07:09 Lulunx

Hi,

I ran into the same problem, but found the solution. I think in your controller you should use this instead:

$scope.$on('colorpicker-closed', function(event, colorObject){
        console.log(event, colorObject);
   });

And colorpicker-closed="switchColor()" is unnecessary in your html code.

Cheers,

Levi

llevii avatar Oct 09 '17 11:10 llevii

Hi,

Thanks for your help, it worked. I didn't know about .$on ( it was maybe my problem ! )

Lucas

Lulunx avatar Oct 10 '17 10:10 Lulunx