From 2a0f140ef2eb10026aa719faa68e0a292da2505f Mon Sep 17 00:00:00 2001 From: Indri Muska Date: Fri, 15 Jan 2016 11:36:49 +0100 Subject: [PATCH] Feature: added `change` callback --- bower.json | 2 +- dist/angular-selector.js | 7 +++++-- dist/angular-selector.min.js | 4 ++-- package.json | 2 +- src/angular-selector.js | 7 +++++-- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/bower.json b/bower.json index fee420f..9180bd6 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "angular-selector", - "version": "0.6.3", + "version": "0.7.0", "authors": [ "Indri Muska " ], diff --git a/dist/angular-selector.js b/dist/angular-selector.js index 412e675..ed1bcb7 100644 --- a/dist/angular-selector.js +++ b/dist/angular-selector.js @@ -29,6 +29,7 @@ options: '=?', rtl: '=?', api: '=?', + change: '&?', remote: '=?', remoteParam: '@?', removeButton: '=?', @@ -359,6 +360,10 @@ scope.$watch('selectedValues', function (newValue, oldValue) { if (angular.equals(newValue, oldValue)) return; scope.updateValue(); + if (angular.isFunction(scope.change)) + scope.change(scope.multiple + ? { newValue: newValue, oldValue: oldValue } + : { newValue: newValue[0], oldValue: oldValue[0] }); }, true); scope.$watch('options', function (newValue, oldValue) { if (angular.equals(newValue, oldValue) || scope.remote) return; @@ -445,8 +450,6 @@ '
' + - '' + '