Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

498
Views
angular2 forms validation - what does .ng-invalid:not(form)

Question

What does the :not(form) part of a CSS selector for angular2 form elements?

Context

The current version of the Angular2 tutorial about forms makes use of two-way data binding, change tracking and validation to add CSS classes to form elements.

Their example form looks like this enter image description here

And their example code to achive the red bar looks like this

.ng-invalid:not(form)  {
   border-left: 5px solid #a94442; /* red */
}
over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Ah, I found it out myself!

the ng-invalid class is <form> elements, too.

So, :not(form) is added to prevent a red bar on the left side of the whole form.

over 4 years ago · Santiago Trujillo Report

0

The :not(form) part of the CSS selector represents elements that do not match a form element. So any DOM element excluding form elements.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!