Skip to content

Commit 0f1b48a

Browse files
committed
fix(attrs): make placeholder and title bindable
1 parent d0d3fbf commit 0f1b48a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

dist/angular-selectize.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,23 @@ angular.module('selectize', []).value('selectizeConfig', {}).directive("selectiz
9494
scope.$watch('ngDisabled', toggle);
9595
};
9696

97+
// watch for changes to attributes that are copied down to the
98+
// input and keep them in sync. We have set the attr in the watch expression
99+
// rather than in the listener because after an update the selectize library
100+
// may have reverted the placeholder to the un-interpolated value even though
101+
// the value of element.attr(prop) has not changed
102+
var input;
103+
['placeholder', 'title'].forEach(function(prop){
104+
scope.$watch(function() {
105+
if (element) {
106+
var val = element.attr(prop);
107+
input = input || element.siblings('.selectize-control').find('input');
108+
input.attr(prop, val);
109+
}
110+
});
111+
});
112+
113+
97114
element.selectize(settings);
98115

99116
element.on('$destroy', function() {

0 commit comments

Comments
 (0)