How can I add a disabled attribute for tag input using ngTagsInput?

I have a custom directive that I use to control user access through my site. I use this to add 'disabled = "disabled" "attribute to html tags.

However, when I try to use this with tag input it doesn't work. I assume this is because ngTagsInput uses its own directive for injecting tags.

I have read the documentation and cannot find a solution for what I am looking for.

Here is my code:

Html:

<div access-level="Admin">
   <tags-input ng-model="tags" on-tag-added="addNewTag($tag)" on-tag-removed="removeTag($tag)">
       <auto-complete source="loadTags($query)" min-length="0"></auto-complete>
   </tags-input>
</div>

      

Is there any work around for this?

Thank.

+1


source to share


2 answers


It is currently not supported, but it looks like it will be in the next major release (2.3.0): https://github.com/mbenford/ngTagsInput/issues/102



Edit: 2.3.0 is missing; See the following link for details https://github.com/mbenford/ngTagsInput/blob/master/CHANGELOG.md#features

0


source


I couldn't find this option in version 2.3.0, but at least they included the usual disabled attribute. What I did to hide the delete button and Add Tag input box was to add some rules in CSS.

tags-input[disabled] .remove-button {
    display: none;
}
tags-input[disabled] input.input {
    display: none;
}

      



Perhaps there is a better way to do this, this was the fastest I could find.

0


source







All Articles