bentorfs / angular-bootstrap-multiselect

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

How to change Select drop down name to some custom text? #48

Open vinodagouda opened 7 years ago

vinodagouda commented 7 years ago

I would like to change the Select drop down name to some other custom name. For example, I would like to change it to Campaign Select. How to do it? Thanks in advance. I am adding a screen shot below for your reference.

screenshot from 2017-07-17 11 34 01

aboudard commented 7 years ago

For those who didn't find this at first look, just watch the binding options in the directive, you have : labels: '=?',

and in the html : {{getButtonText()}}

which leads to the method and the following option : $scope.getButtonText = function () { ... $scope.labels && $scope.labels.select ? $scope.labels.select : ($scope.placeholder || 'Select'); ...

so just add the labels option, in the html or in the js : labels="{selectAll:'Tous',unselectAll:'Aucun',select:'Thème'}"

Talhah commented 7 years ago

If there is a better solution to this please share.

aboudard commented 7 years ago

@Talhah what do you mean by "better" ?

Talhah commented 7 years ago

@aboudard Sorry, this method is the best. I did not understand the solution.

Talhah commented 7 years ago

For those who are confused as to where the labels object should be placed please see below example:

<multiselect ng-model="$ctrl.yourModel" options="yourOptions" labels="{select:'Custom Label'}" display-prop="yourProperty"></multiselect>

Nice and simple fix via @aboudard

PallaviKharade commented 6 years ago

In bootstrap-multiselect.js file dropdown name is set using nonSelectedText: 'None selected' .You can change none selected to name which you want to set