Skip to content

Commit

Permalink
fix(attrs): make placeholder and title bindable
Browse files Browse the repository at this point in the history
  • Loading branch information
nbrustein committed Apr 14, 2016
1 parent d0d3fbf commit 0f1b48a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions dist/angular-selectize.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,23 @@ angular.module('selectize', []).value('selectizeConfig', {}).directive("selectiz
scope.$watch('ngDisabled', toggle);
};

// watch for changes to attributes that are copied down to the
// input and keep them in sync. We have set the attr in the watch expression
// rather than in the listener because after an update the selectize library
// may have reverted the placeholder to the un-interpolated value even though
// the value of element.attr(prop) has not changed
var input;
['placeholder', 'title'].forEach(function(prop){
scope.$watch(function() {
if (element) {
var val = element.attr(prop);
input = input || element.siblings('.selectize-control').find('input');
input.attr(prop, val);
}
});
});


element.selectize(settings);

element.on('$destroy', function() {
Expand Down

0 comments on commit 0f1b48a

Please sign in to comment.