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

Open/close colorpicker programmatically #137

Closed gandaldf closed 7 years ago

gandaldf commented 8 years ago

How can I open and close the colorpicker programmatically when it's embedded in another directive? I've tried using colorpicker-is-open but I always get a $diget error.

BabOuDev commented 7 years ago

When the colorpicker is nested in another directive, we get a digest error from the library (even using $timeout) if trying to open/close it via the "colorpicker-is-open" attribute.

scope.$digest could be removed, because it is seems not necessary (l.526 and l.562), as colorpickerTemplate is already an angular element, it should be already handled by angular cycle (and it worked for me by removing it).

But just in case it is of some use and I didn't figure it out, I preferred to add a check on the parent directive cycle status instead of removing it.