11/*!
2- * angularjs-color-picker v0.7.2
2+ * angularjs-color-picker v0.8.0
33 * https://github.com/ruhley/angular-color-picker/
44 *
55 * Copyright 2015 ruhley
66 *
7- * 2015-12-18 09:39:34
7+ * 2015-12-30 09:16:44
88 *
99 */
1010if ( typeof module !== "undefined" && typeof exports !== "undefined" && module . exports === exports ) {
@@ -33,10 +33,13 @@ if (typeof module !== "undefined" && typeof exports !== "undefined" && module.ex
3333 colorPickerSwatch : '=' ,
3434 colorPickerSwatchOnly : '=' ,
3535 colorPickerSwatchPos : '=' ,
36- colorPickerSwatchBootstrap : '='
36+ colorPickerSwatchBootstrap : '=' ,
37+ colorPickerOnChange : '&' ,
3738 } ,
3839 templateUrl : 'template/color-picker/directive.html' ,
3940 link : function ( $scope , element , attrs , control ) {
41+ $scope . onChangeValue = null ;
42+
4043 $scope . init = function ( ) {
4144 // if no color provided
4245 if ( $scope . ngModel === undefined ) {
@@ -93,14 +96,17 @@ if (typeof module !== "undefined" && typeof exports !== "undefined" && module.ex
9396 } else if ( $scope . colorMouse ) {
9497 $scope . colorUp ( event ) ;
9598 $scope . $apply ( ) ;
99+ $scope . onChange ( event ) ;
96100 // mouse event on hue slider
97101 } else if ( $scope . hueMouse ) {
98102 $scope . hueUp ( event ) ;
99103 $scope . $apply ( ) ;
104+ $scope . onChange ( event ) ;
100105 // mouse event on opacity slider
101106 } else if ( $scope . opacityMouse ) {
102107 $scope . opacityUp ( event ) ;
103108 $scope . $apply ( ) ;
109+ $scope . onChange ( event ) ;
104110 }
105111 } ;
106112
@@ -120,6 +126,13 @@ if (typeof module !== "undefined" && typeof exports !== "undefined" && module.ex
120126 }
121127 } ;
122128
129+ $scope . onChange = function ( event ) {
130+ if ( $scope . ngModel !== $scope . onChangeValue ) {
131+ $scope . onChangeValue = $scope . ngModel ;
132+ $scope . colorPickerOnChange ( { $event : event , color : $scope . ngModel } ) ;
133+ }
134+ } ;
135+
123136
124137 $scope . initConfig = function ( ) {
125138 $scope . config = { } ;
@@ -555,7 +568,7 @@ angular.module('color.picker').run(['$templateCache', function($templateCache) {
555568 '<div class="color-picker-wrapper" ng-class="{\'color-picker-swatch-only\': config.swatchOnly}">\n' +
556569 ' <div ng-class="{\'input-group\': config.swatchBootstrap && config.swatch}">\n' +
557570 ' <span ng-if="config.swatchPos === \'left\'" ng-attr-style="background-color: {{swatchColor}};" class="color-picker-swatch" ng-click="focus()" ng-show="config.swatch" ng-class="{\'color-picker-swatch-left\': config.swatchPos !== \'right\', \'color-picker-swatch-right\': config.swatchPos === \'right\', \'input-group-addon\': config.swatchBootstrap}"></span>\n' +
558- ' <input class="color-picker-input form-control" type="text" ng-model="ngModel" size="7" ng-focus="show()" ng-class="{\'color-picker-input-swatch\': config.swatch && !config.swatchOnly && config.swatchPos === \'left\'}">\n' +
571+ ' <input class="color-picker-input form-control" type="text" ng-model="ngModel" ng-change="onChange($event)" size="7" ng-focus="show()" ng-class="{\'color-picker-input-swatch\': config.swatch && !config.swatchOnly && config.swatchPos === \'left\'}">\n' +
559572 ' <span ng-if="config.swatchPos === \'right\'" ng-attr-style="background-color: {{swatchColor}};" class="color-picker-swatch" ng-click="focus()" ng-show="config.swatch" ng-class="{\'color-picker-swatch-left\': config.swatchPos !== \'right\', \'color-picker-swatch-right\': config.swatchPos === \'right\', \'input-group-addon\': config.swatchBootstrap}"></span>\n' +
560573 ' </div>\n' +
561574 ' <div class="color-picker-panel" ng-show="visible" ng-class="{\n' +
0 commit comments