diff --git a/.gitignore b/.gitignore index d8d7394..eff14bc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules bower_components -demo/bower_components \ No newline at end of file +demo/bower_components +.tern-port diff --git a/src/select2.js b/src/select2.js index 828032d..393b709 100644 --- a/src/select2.js +++ b/src/select2.js @@ -149,7 +149,7 @@ angular.module('ui.select2', []).value('uiSelect2Config', {}).directive('uiSelec // Set the view and model value and update the angular template manually for the ajax/multiple select2. elm.bind("change", function (e) { e.stopImmediatePropagation(); - + if (scope.$$phase || scope.$root.$$phase) { return; } @@ -188,6 +188,14 @@ angular.module('ui.select2', []).value('uiSelect2Config', {}).directive('uiSelec elm.select2('readonly', !!value); }); + if(attrs.uiSelect2) { + scope.$watch(attrs.uiSelect2, function(newVal) { + if(newVal) { + elm.select2(angular.extend({}, options, scope.$eval(attrs.uiSelect2))); + } + }); + } + if (attrs.ngMultiple) { scope.$watch(attrs.ngMultiple, function(newVal) { attrs.$set('multiple', !!newVal); diff --git a/test/karma.conf.js b/test/karma.conf.js index b5658bc..d5f21b3 100644 --- a/test/karma.conf.js +++ b/test/karma.conf.js @@ -15,7 +15,7 @@ module.exports = function(config) { // list of files / patterns to load in the browser files: [ // Dependencies - 'bower_components/jquery/jquery.js', + 'bower_components/jquery/dist/jquery.js', 'bower_components/angular/angular.js', 'bower_components/angular-mocks/angular-mocks.js', 'bower_components/select2/select2.js',