angular-bootstrap-colorpicker
angular-bootstrap-colorpicker copied to clipboard
colorpicker-closed not fired
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
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
Hi,
Thanks for your help, it worked. I didn't know about .$on ( it was maybe my problem ! )
Lucas