Reputation: 33
I'm using https://github.com/mbenford/ngTagsInput.
I created a basic form with a url and a tag-input field that is required.
Since it's required, i used the attribute min-tags="1"
I used it in conjonction with bootstrap stylehseet.
When displayed, the field appears with a red shadow border (since it is empty), even before any submit of the form. This is really annoying, is there any workaround ?
Thank you
Edit : sample code :
<tags-input min-tags="1" ng-model="mytags"></tags-input>
Have done a plunker : http://plnkr.co/edit/EQcYfr4vLpkeJESho3GL?p=preview
Upvotes: 3
Views: 1634
Reputation: 14114
You can simply use a custom class to handle the pristine state:
CSS
.custom-tags.ng-pristine .tags {
box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
border: 1px solid #ccc
}
HTML
<tags-input min-tags="1" ng-model="mytags" class="custom-tags"></tags-input>
Also, Angular 1.3 isn't officially supported yet. This is particularly important here because both pristine and dirty states won't be correctly set if you use that version of the framework.
Upvotes: 3