From e1dbab97b7b9dc4747f76cea4afc8fce8666fec1 Mon Sep 17 00:00:00 2001 From: Vladimir Golub Date: Tue, 24 Feb 2015 16:06:42 +0200 Subject: [PATCH] add ability to update model value --- src/select2.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/select2.js b/src/select2.js index c3b99ae..25dd103 100644 --- a/src/select2.js +++ b/src/select2.js @@ -168,6 +168,10 @@ angular.module('ui.select2', []).value('uiSelect2Config', {}).directive('uiSelec if (scope.$$phase || scope.$root.$$phase) { return; } + + if(opts.formatModel){ + controller.$parsers.unshift(opts.formatModel); + } scope.$apply(function () { controller.$setViewValue( convertToAngularModel(elm.select2('data')));