ngTagsInput icon indicating copy to clipboard operation
ngTagsInput copied to clipboard

How to disable the creation of new tags

Open playUruguay opened this issue 11 years ago • 5 comments

Hi! Im trying to use ngTagsInput like a select with suggesting existent data. How to disable the creation of new labels ?


    

$scope.loadTags = function(query) {
        return $http.get('/api/users?conditions={ "name": { "$regex": "' + query + '" } }', config);
    };

playUruguay avatar Apr 15 '15 13:04 playUruguay

Hi. Try set property add-from-autocomplete-only="true" for your tags-input

oleksiyo avatar Apr 20 '15 15:04 oleksiyo

hi @oleksiyo did try that but folks can still type things inside the input box, what i want to do instead is have it such that only the pre-populated tags appear and nothing more can be manually entered - curious, how can I make this happen?

ghost avatar Apr 21 '15 03:04 ghost

@playUruguay Set the add-from-autocomplete-only option as true, as suggested by @oleksiyo, and the user will be able to add tags only by selecting a suggestion from the autocomplete list.

@codefullon ngTagsInput supports Angular's ngDisabled directive. If you do the following the tags-input element will be disabled and the user won't be able to neither add nor remove any tags.

<tags-input ng-model="tags" ng-disabled="true"></tags-input>

mbenford avatar Apr 21 '15 19:04 mbenford

excellent, thanks @mbenford, that worked :-)

ghost avatar Apr 22 '15 04:04 ghost

Can this issue be closed?

mbenford avatar Jul 14 '15 04:07 mbenford