mbenford / ngTagsInput

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

Clear placeholder #86

Closed bsr203 closed 10 years ago

bsr203 commented 10 years ago

Is there a way to clear the placeholder. If I try placeholder=' ' (with a blank space), or placeholder='' , it still shows 'Add a tag'. Can you provide an option to clear it (may check for empty string)

mbenford commented 10 years ago

Hi @bsr203.

To change the placeholder's default value you should use the tagsInputConfig provider:

app.config(function(tagsInputConfigProvider) {
    tagsInputConfigProvider.setDefaults('tagsInput', {
        placeholder: ''
    });
});

Keep in mind that by doing that all tags-input elements in your application will use the same default value.

Kind regards.

bsr203 commented 10 years ago

thanks.. it indeed work. but, a small issue. if I enter some text, and clear it (backspace), then the text marker (blinking cursor position indicator) disappears. that is, it is there first time, but not after you enter something and clear. Once I remove the tagsInputConfigProvider , it works fine. can you please have a look.

On Mon, Feb 24, 2014 at 8:31 AM, Michael Benford notifications@github.comwrote:

Hi @bsr203 https://github.com/bsr203.

To change the placeholder's default value you should use the tagsInputConfig provider:

app.config(function(tagsInputConfigProvider) { tagsInputConfigProvider.setDefaults('tagsInput', { placeholder: '' });});

Keep in mind that by doing that all tags-input elements in your application will use the same default value.

Kind regards.

Reply to this email directly or view it on GitHubhttps://github.com/mbenford/ngTagsInput/issues/86#issuecomment-35885905 .

mbenford commented 10 years ago

Of course! The input's width is automatically calculated based on its content, when there is any, or on its placeholder width when the input is empty. I totally forgot that.

There could be a minimum width to address situations like this. I'll think more about it.

mbenford commented 10 years ago

@bsr203

I've just pushed a fix (12b5beba230304fd22b6fef8eb613f6133860c0a) into master which resolves the input width problem.

Kind regards.