ruhley / angular-color-picker

Vanilla AngularJS Color Picker Directive with no requirement on jQuery
http://ruhley.github.io/angular-color-picker/
MIT License
165 stars 78 forks source link

Content Security Policy breaks color picker #53

Closed Frank3K closed 8 years ago

Frank3K commented 8 years ago

When using a Content Security Policy (CSP, docs at MDN) without unsafe-inline for style-src the color picker does not work. This is because of the various ng-attr-style properties in the template.

The solution to this issue would be to remove the ng-attr-style attributes from the template and apply the styling using JS in the link function using .css(properties).

If you want I can try to make a PR to resolve this issue.

ruhley commented 8 years ago

Fixed in commit 2ef76023f227c3969ea61a53eec9b99f4203d267 and release in v1.0.0.

Frank3K commented 8 years ago

Wow thanks!

For extra performance you could maybe move the querySelector + angular.element() outside the $watches.