Skip to content Skip to sidebar Skip to footer

Jscolor Pick Up Color To Trigger Angularjs Ng-change

I use this plugin, JSColor (http://jscolor.com/) and bind the input value with AngularJS ng-model like the following:
$scope.alert = function(myColor) {
    alert(myColor);
}

Or with injecting the $window service:

.controller('ctrl', function($scope, $window) {
    $scope.alert = function(color) {
        $window.alert(color);
    }
})

Solution 2:

Your on-change is not fired because of the alert called. ng-change="alert(myColor)"

$scope.alert = function(myColor) {
   alert(myColor);
}

Post a Comment for "Jscolor Pick Up Color To Trigger Angularjs Ng-change"