python ruby-programming-language Smalltalk Vue.js Knockoutjs TypeScript JavaScript, OOPs JavaScript Angular 8,7,6,5,4 and 2 Interview Questions and Answers Angular 8,7,6,5,4 and 2 Interview Questions and Answers Angular 4 Angular 2 AngularJs 1.x NodeJs Perl Programming R Programming RequireJs Rust Programming Backbonejs closure programming language go-programming-language kotlin-programming-language
Angular 4 CSS Classes

Angular 5 and 4 CSS Classes for Forms Validation - CSS Style

The forms are building blocks of any web and mobile applications and Angular 5 and 4 provides us two approaches for developing apps(Angular forms) -
1)      Template Driven Forms

The CSS classes for Angular Control
Just like AngularJs 1.x, Angular automatically shiners many control properties onto the form control element as CSS classes. These Angular classes look like –
1)      .ng-valid
2)      .ng-invalid
3)      .ng-pending
4)      .ng-pristine
5)      .ng-dirty
6)      .ng-untouched
7)      .ng-touched

The example looks like
.ng-valid[required], .ng-valid.required  {
    font-size: 16px;
    text-align: center;
    border-left: 10px solid rgb(218, 200, 43); /* yellow */
}

.ng-invalid:not(form)  {
    font-size: 16px;
    text-align: center;
    border-left: 10px solid #e94646; /* red */
}

In the above example, the “ng-valid” and “ng-invalid” classes is used to set the fonts size, color and align of each form control's.

In the HTML page looks like
//The .ng-valid[required] rule is valid for
<input class="ng-valid" required>

//The .ng-valid.required rule is valid for
<input class="ng-valid required">

//Both rules are valid for
<input class="ng-valid required" required>



I hope you are enjoying with this post! Please share with you friends. Thank you!!
ANIL SINGH

Hi there! Welcome to my blog. My name is Anil Singh. I'm a author of this blog. For more detail about me, kindly refer to this link..
My Blogs - http://code-sample.com and http://code-sample.xyz
My Books - Interview Questions and Answers Books- Get Your Book in 15+ Digital Stores Worldwide..

You Might Also Like
www.code-sample.com/. Powered by Blogger.
ASK Questions