0

I have an input tag which is bound to a scope variable by ng-model. All such input tags get validated and I wrote some custom styling for ng-valid etc. But now I want just one input tag which should not do anything after typing. Old school input tag per se with ng-model binding. How do I prevent the validation on such an element?

%form
  %input(ng-model='searchText')

I tried the novalidate tag on the form but it is only to prevent HTML5 validation I guess. Could not find anything else.. Any help ppl?

8
  • remove name attribute from that element, but I'm curious to know why you want that? Commented Apr 6, 2015 at 13:07
  • What validation properties are being used on the input? If none are set you shouldn't have a problem Commented Apr 6, 2015 at 13:09
  • But there is no name attribute in the input tag. It is a search box, hence I dont want to change the look when a user types in it. Its always a valid entry. I have a solution to use '!important' in the css for that tag.. But don't wanna do that since we might have to go for 508 compliance later on Commented Apr 6, 2015 at 13:10
  • @charlietfl I am using input validation in all my other input tags and wrote the .ng-valid css in a centralised location. I don't want this input tag to incur the css of .ng-valid. Commented Apr 6, 2015 at 13:12
  • 1
    Damn. Thats also not working since angular adds two classes and styles it with both as selectors eg: input.ng-valid.ng-dirty{//css here} I am having to add another dummy class 'novalidate' and add that to make the css more specific. Commented Apr 6, 2015 at 13:39

1 Answer 1

0

You could simply achieve this by adding you own custom class on that field & write whole custom css in that,

CSS

input.ng-valid.my-class,  input.ng-valid.my-class:focus{
  border: 1px solid green;
}

Working Plunkr

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.