bentorfs / angular-bootstrap-multiselect

Native angularJS custom form element
http://bentorfs.github.io/angular-bootstrap-multiselect/
MIT License
79 stars 111 forks source link

Change Dropdown Placeholder #29

Closed thiruopti closed 7 years ago

thiruopti commented 7 years ago

How to change the default placeholder in that dropdown?

Duskfall commented 7 years ago

Just had the same problem. I saw in code that there is an attribute in the directive and it works.


<multiselect default-text="your placeholder text here"></multiselect>
stand579 commented 7 years ago

I believe the default-text attribute never made it to a release version; however, since 1.1.5 you can use the labelsattribute to pass a configuration object to customize all multiselect labels. Use it like this:

<multiselect ng-model="selection" 
    options="options" 
    show-select-all="true"
    show-unselect-all="true" 
    labels="labels">
</multiselect>

and the labels has the following format:

$scope.labels = {
      itemsSelected: 'selected',
      search: 'Search...',
      select: 'Select',
      selectAll: 'Select all',
      unselectAll: 'Unselect all'
};

This is useful if you want to translate the labels into different languages, yet the properties are optional and if you don't define them the default multiselect labels will be displayed.