mbenford / ngTagsInput

Tags input directive for AngularJS
http://mbenford.github.io/ngTagsInput
MIT License
1.64k stars 541 forks source link

Placeholder should not be shown if there is at least one tag #855

Open conraddamon opened 6 years ago

conraddamon commented 6 years ago

Browsers show the placeholder only if there is no input. Tags should qualify as input, so the placeholder should be removed if there is at least one tag present.

rognstad commented 6 years ago

You can currently accomplish this by:

  1. Enabling active interpolation of the placeholder in your app config:
    .config(function(tagsInputConfigProvider) {
    tagsInputConfigProvider.setActiveInterpolation('tagsInput', { placeholder: true });
    })
  2. Binding the placeholder to an expression: placeholder="{{myPlaceholder}}"
conraddamon commented 6 years ago

Yep, I saw that in several places as a solution. My take is that the component should always behave that way, and it shouldn't be necessary for the client to configure it to do that. I've built autocomplete widgets before, and reasoned that wrapping up some input into a bubble/chiclet doesn't change the fact that there has been input, therefore the placeholder should not be shown.