-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix($selectMultiple): allow user to override getPlaceholder()
Behavior
#2015
Conversation
NOTE: user cannot override |
User can provide their custom `getPlaceholder()` function. E.g. to keep placeholder activated in multipleSelect component, you can use this one: ``` angular.module('myApp').directive('myAppUiSelectPlaceholderAlwaysVisible', function() { return { require: 'uiSelect', link: function($scope, $element, attrs, $select) { $select.getPlaceholder = function () { return $select.placeholder; } } } }); ``` And then add this directive to the `<ui-select>` html element closes angular-ui#1796
src/uiSelectController.js
Outdated
@@ -65,6 +65,12 @@ uis.controller('uiSelectCtrl', | |||
return isNil(ctrl.selected) || ctrl.selected === '' || (ctrl.multiple && ctrl.selected.length === 0); | |||
}; | |||
|
|||
ctrl.getPlaceholder = function(){ | |||
//Refactor single? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove this comment?
test/select.spec.js
Outdated
@@ -15,6 +15,14 @@ describe('ui-select tests', function () { | |||
Escape: 27 | |||
}; | |||
|
|||
var multipleTagsTmpl = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't you use createUiSelectMultiple
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments about the PR 😄
@Jefiozie done Btw, have you considered splitting tests into multiple files? Better readability, mainainability, it will be clear which tests relate to what and which helper functions available. Also will be easier to run only tests you are working on during dev phase. |
@Jefiozie How about merging this one? |
User can provide their custom
getPlaceholder()
function. E.g. to keep placeholder activated in multipleSelect component, you can use this one:And then add this directive to the
<ui-select>
html elementcloses #1796