buberdds / angular-bootstrap-colorpicker

Native AngularJS colorpicker directive. No dependency on jQuery or jQuery plugin is required.
MIT License
419 stars 226 forks source link

Provide a way to close the colorpicker #66

Closed mattlewis92 closed 9 years ago

mattlewis92 commented 9 years ago

My use case is I want to auto close the popup when a color has been selected. The implementation could be:

1/ Add an optional attribute called colorpicker-close-on-select which would close the popup when a color has been selected.

2/ Add an attribute called colorpicker-is-open="booleanValueBoundToScope" where changing booleanValueBoundToScope would show / hide the color picker, and could also be used from the parent to tell if the color picker is currently open

3/ Expose the hideColorpickerTemplate function on the directives scope so you can simply do ng-change="hideColorpickerTemplate()"

Will try to find the time to send a PR if a suitable implementation could be decided on.

Cheers!

buberdds commented 9 years ago

Hi @mattlewis92, the color picker is not creating any child or isolate scope, so third option will pollute a scope. Maybe we should avoid this? As far as I remember there was a PR that is using colorpickerWithInput, I mean look at different settings too, because a model can change a value in different situations. good luck!

mattlewis92 commented 9 years ago

PR sent at https://github.com/buberdds/angular-bootstrap-colorpicker/pull/68