oi.select
oi.select copied to clipboard
Placeholder show problem
If I write something like this placeholder="{{variable_from_scope}}" placeholder doesn't display. Bug can be repeted in this example http://embed.plnkr.co/LTj8vm5NgYeOKpv22MDL/ If you add variable to controller and try to show the value in placeholder you will see empty field.
+1
It's because the expression is interpolated with an internal scope which typically does not have the required data. Quick patch follows, but the proper solution would probably be to use the parent scope to interpolate these fields.
And another note: the placeholder gets interpolated just once with this solution, so it does not change dynamically.
--- a/src/directives.js
+++ b/src/directives.js
@@ -54,8 +54,8 @@ angular.module('oi.select')
return function(scope, element, attrs, ctrl) {
var inputElement = element.find('input'),
listElement = angular.element(element[0].querySelector('.select-dropdown')),
- placeholder = placeholderFn(scope),
- multiplePlaceholder = multiplePlaceholderFn(scope),
+ placeholder = placeholderFn(scope) || attrs.placeholder || '',
+ multiplePlaceholder = multiplePlaceholderFn(scope) || attrs.multiplePlaceholder || '',
elementOptions = optionsFn(scope.$parent) || {},
options = angular.extend({cleanModel: elementOptions.newItem === 'prompt'}, oiSelect.options, elementOptions),
editItem = options.editItem,