Change the way changes to underlying model are watched and updated for select2 elements

This commit is contained in:
Rob Harrington
2015-11-16 10:31:22 +11:00
parent 767671c3b4
commit 3b2bdb8397

View File

@@ -4,5 +4,6 @@ angular.module("admin.indexUtils").directive "select2MinSearch", ($timeout) ->
element.select2
minimumResultsForSearch: attrs.select2MinSearch
scope.$watch attrs.ngModel, (newVal, oldVal) ->
$timeout -> element.trigger('change')
ngModel.$formatters.push (value) ->
element.select2('val', value)
value