ng2-select2-demo icon indicating copy to clipboard operation
ng2-select2-demo copied to clipboard

Placeholder Not Working in single Select

Open faizalshap opened this issue 7 years ago • 2 comments

Hi, I have tried giving placeholder in Select2 Options but it doesn't work multiple is set to false however if multiple is set to true, then placeholder works.

I have also viewed in demo and there are no demos which shows Placeholder in single Select. Also, in single select, by default first option is selected, however value is not selected i.e value is empty.
This is my options var -

  public options: Select2Options = {
    minimumResultsForSearch: 9001,
    placeholder: 'Select project...',
  };

Thanks.

faizalshap avatar Aug 03 '17 10:08 faizalshap

What worked for ma as quick-and-dirty fix was to first push an item with empty strings to the data array: {id: '', text: ''} This enables the placeholder for me so far.

mchl18 avatar Feb 22 '18 16:02 mchl18

This module support, but dont have documentation. Here is my finding which can help others

<select2 [options]="{placeholder:'Your Select placeholder'}"

korisantosh avatar Apr 09 '19 10:04 korisantosh