/** * Created by wisestone on 2018-05-09. */ 'use strict'; define(['app'], function (app) { app.directive('colorPalettePicker', [ function () { return { scope : { target : "=" }, restrict : 'A', link : function (scope, element, attrs) { $(element).colorPalette({ colors : [ ["#665fff", "#3598fe", "#3bcde2", "#98c220", "#357d57", "#c940ea", "#ff5f99", "#ff9057"], ["#febd35", "#888888"] ] }) .on('selectColor', function (e) { scope.target = e.color; if (scope.$root.$$phase != '$apply' && scope.$root.$$phase != '$digest') { scope.$apply(); } }); } } }]) });