{"id":90284,"date":"2019-04-04T13:00:24","date_gmt":"2019-04-04T10:00:24","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/?p=90284"},"modified":"2019-04-02T15:24:50","modified_gmt":"2019-04-02T12:24:50","slug":"angular-6-reactive-forms-validation-example","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2019\/04\/angular-6-reactive-forms-validation-example.html","title":{"rendered":"Angular 6 Reactive Forms Validation Example"},"content":{"rendered":"<p>Welcome readers, in this tutorial, we will learn the basic of Reactive Forms in angular and perform custom validations on the form.<\/p>\n<h2>1. Introduction<\/h2>\n<p>In a web application, a form is a common approach that allows users to submit input and interact with the application. Frequently used for user login, information search, and feedback submission. The angular framework provides <em>Template-driven<\/em> and <em>Reactive-driven<\/em> forms to communicate with the users.<\/p>\n<ul>\n<li>The template-driven forms use the in-built directives (such as <code>ngModel<\/code>, <code>ngModelGroup<\/code>, and <code>ngForm<\/code>) available in the Forms module<\/li>\n<li>The reactive driven forms use the <code>FormControl<\/code>, <code>FormGroup<\/code>, and <code>FormBuilder<\/code> classes available in the Reactive Forms module\n<ul>\n<li>Offer predictability and synchronous access to the data model<\/li>\n<li>Offer reactive patterns, testing, and validation<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>To work with reactive forms, open the visual studio code and let us see how to implement this tutorial in angular 6 frameworks.<\/p>\n<h2>2. Angular 6 Reactive Forms Validation Example<\/h2>\n<p>Here is a systematic guide for implementing this tutorial.<\/p>\n<h3>2.1 Tools Used<\/h3>\n<p>We are using Visual Studio Code and Node Terminal to compile and execute the angular code on a browser.<\/p>\n<h3>2.2 Project Structure<\/h3>\n<p>In case you are confused about where you should create the corresponding files or folder, let us review the project structure of the angular application.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" width=\"330\" height=\"479\" src=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/03\/angular-reactiveform-custom-validation-project-structure-guide-1.jpg\" alt=\"Angular 6 Reactive Forms Validation - Application Structure\" class=\"wp-image-90285\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/03\/angular-reactiveform-custom-validation-project-structure-guide-1.jpg 330w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/03\/angular-reactiveform-custom-validation-project-structure-guide-1-207x300.jpg 207w\" sizes=\"(max-width: 330px) 100vw, 330px\" \/><figcaption>Fig. 1: Application Structure<\/figcaption><\/figure>\n<\/div>\n<h2>3. Creating Angular application<\/h2>\n<p>Run the <code>ng new angular-reactive-form-custom-validations-assignment<\/code> command in the npm console to create a new angular project. Once the new project is created, following the below steps.<\/p>\n<h3>3.1 Import Reactive forms module<\/h3>\n<p>To start working with the reactive forms we will need to import the <code>ReactiveFormsModule<\/code> module in <code>src\/app\/app.module.ts<\/code> file.<\/p>\n<p><span style=\"text-decoration: underline\"><em>app.module.ts<\/em><\/span><\/p>\n<pre class=\"brush:js; wrap-lines:false;\">\/\/ Importing the reactive forms module.\nimport { ReactiveFormsModule } from '@angular\/forms';\n\n\/\/ Declaring the reactive forms module in the imports section of NgModule decorator.\nimports: [\n    BrowserModule, ReactiveFormsModule\n  ],\n<\/pre>\n<h3>3.2 Building the Form Template<\/h3>\n<p>To create a form we will use the different reactive form property tags introduced in the angular framework. We will,<\/p>\n<ul>\n<li>Use the <code>formGroup<\/code> property to bind our form with a name (i.e. <code>myform<\/code>). This will bind the form with a <code>FormGroup<\/code> object declared in the component class<\/li>\n<li>Use the <code>formControlName<\/code> property to bind the input fields to the individual form controls<\/li>\n<li>Use the <code>ngSubmit<\/code> property to submit the form and display the values on successful validation<\/li>\n<\/ul>\n<p>Add the following code the <code>src\/app\/app.component.html<\/code> file.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p><span style=\"text-decoration: underline\"><em>app.component.html<\/em><\/span><\/p>\n<pre class=\"brush:html; wrap-lines:false;\">&lt;div class=\"container myWidth\"&gt;\n  &lt;div class=\"row\"&gt;\n    &lt;div class=\"col-md-6 offset-md-3\"&gt;\n      &lt;h2 class=\"text-center\"&gt;{{ title }}&lt;\/h2&gt;\n      &lt;hr \/&gt;\n      &lt;form [formGroup]=\"myForm\" (ngSubmit)=\"_formSubmit()\"&gt;\n        &lt;!-- EMAIL ADDRESS FIELD --&gt;\n        &lt;div class=\"form-group\"&gt;\n          &lt;input type=\"text\" formControlName=\"email\" class=\"form-control\" placeholder=\"Enter email\" \/&gt;\n          &lt;div *ngIf=\"myForm.controls.email.invalid &amp;&amp; myForm.controls.email.touched\" class=\"text-danger\"&gt;\n            &lt;small *ngIf=\"myForm.controls.email.errors.required\"&gt;Email address is required.&lt;\/small&gt;\n            &lt;small *ngIf=\"myForm.controls.email.errors.email\"&gt;Email must be a valid email address.&lt;\/small&gt;\n          &lt;\/div&gt;\n        &lt;\/div&gt;\n        &lt;!-- PASSWORD FIELD --&gt;\n        &lt;div class=\"form-group\"&gt;\n          &lt;input type=\"password\" formControlName=\"pwd\" class=\"form-control\" placeholder=\"Enter password\" \/&gt;\n          &lt;div *ngIf=\"myForm.controls.pwd.invalid &amp;&amp; myForm.controls.pwd.touched\" class=\"text-danger\"&gt;\n            &lt;small *ngIf=\"myForm.controls.pwd.errors.required\"&gt;Password is required.&lt;\/small&gt;\n            &lt;small *ngIf=\"myForm.controls.pwd.errors.minlength\"&gt;Password must be at least 6 characters.&lt;\/small&gt;\n          &lt;\/div&gt;\n        &lt;\/div&gt;\n        &lt;!-- CONFIRM PASSWORD FIELD --&gt;\n        &lt;div class=\"form-group\"&gt;\n          &lt;input type=\"password\" formControlName=\"cnfPwd\" class=\"form-control\" placeholder=\"Enter confirm password\" \/&gt;\n          &lt;div *ngIf=\"myForm.controls.cnfPwd.invalid &amp;&amp; myForm.controls.cnfPwd.touched\" class=\"text-danger\"&gt;\n            &lt;small *ngIf=\"myForm.controls.cnfPwd.errors.required\"&gt;Confirm password is required.&lt;\/small&gt;\n            &lt;small *ngIf=\"myForm.controls.cnfPwd.errors.mustMatch\"&gt;Password &amp; Confirm Password must match.&lt;\/small&gt;\n          &lt;\/div&gt;\n        &lt;\/div&gt;\n        &lt;!-- REGISTER BUTTON --&gt;\n        &lt;div class=\"form-group\"&gt;\n          &lt;input type=\"submit\" value=\"Register\" [disabled]=\"myForm.invalid\" class=\"btn btn-primary\" \/&gt;\n        &lt;\/div&gt;\n      &lt;\/form&gt;\n    &lt;\/div&gt;\n  &lt;\/div&gt;\n&lt;\/div&gt;\n<\/pre>\n<h3>3.3 Creating Custom Validation for Password property<\/h3>\n<p>In the custom validation class, we will match the password &amp; confirm-password property and add the password mismatch validation. Add the following code the <code>src\/app\/Passwordvalidation.ts<\/code> file<\/p>\n<p><span style=\"text-decoration: underline\"><em>Passwordvalidation.ts<\/em><\/span><\/p>\n<pre class=\"brush:js; wrap-lines:false;\">import { AbstractControl } from '@angular\/forms';\n\nexport class Passwordmatch {\n    \/\/ Custom validator to check that two fields match.\n    static matchPassword(ac: AbstractControl) {\n        const pwd = ac.get('pwd');\n        const cnfpwd = ac.get('cnfPwd');\n        if (pwd.value === cnfpwd.value) {\n            return null;\n        }\n\n        ac.get('cnfPwd').setErrors({ mustMatch: true });\n        return true;\n    }\n}\n<\/pre>\n<h3>3.4 Initialize Form data and Validations<\/h3>\n<p>In the component class, we will initialize the form with default values and add some basic validations. In addition, we will define our form group, individual form controls within the form group, and the validator class to set the validation properties for each control. Add the following code the <code>src\/app\/app.component.ts<\/code> file<\/p>\n<p><span style=\"text-decoration: underline\"><em>app.component.ts<\/em><\/span><\/p>\n<pre class=\"brush:js; wrap-lines:false;\">import { Component, OnInit } from '@angular\/core';\n\n\/\/ Importing the reactive form module classes.\nimport { FormGroup, FormBuilder, Validators } from '@angular\/forms';\n\n\/\/ Import custom validator to validate that password and confirm password fields match.\nimport { Passwordmatch } from '.\/Passwordvalidation';\n\n@Component({\n  selector: 'app-root',\n  templateUrl: '.\/app.component.html',\n  styleUrls: ['.\/app.component.css']\n})\n\nexport class AppComponent implements OnInit {\n  title = 'Angular6 Reactive forms custom validation';\n\n  myForm: FormGroup;\n\n  constructor(private fb: FormBuilder) { }\n\n  _formValidate() {\n    \/\/ Here we have used a form builder and an array to allow for multiple validation rules on a form.\n    this.myForm = this.fb.group(\n      {\n        email: ['', Validators.compose([Validators.required, Validators.email])],\n        pwd: ['', Validators.compose([Validators.required, Validators.minLength(6)])],\n        cnfPwd: ['', Validators.required]\n      },\n      {\n        validator: Passwordmatch.matchPassword\n      }\n    );\n  }\n\n  \/\/ To initialize the form group and validations in the 'ngOnInit' lifecycle hook.\n  ngOnInit() {\n    this._formValidate();\n  }\n\n  \/\/ To show how developers can access the form control values.\n  _formSubmit() {\n    if (this.myForm.invalid) {\n      return;\n    }\n    alert('SUCCESS!! :-)\\n\\n' + JSON.stringify(this.myForm.getRawValue()));\n  }\n}\n<\/pre>\n<h2>4. Run the Application<\/h2>\n<p>As we are ready with all the changes, let us compile and run the angular application with <code>ng serve<\/code> command. Once the projects are successfully compiled and deployed, open the browser to test it.<\/p>\n<h2>5. Project Demo<\/h2>\n<p>Open your favorite browser and hit the angular application url (<code>http:\/\/localhost:4200\/<\/code>) to display the index page of the application.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" width=\"713\" height=\"235\" src=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/03\/angular-reactiveform-custom-validation-project-demo-guide-1.jpg\" alt=\"Angular 6 Reactive Forms Validation - Welcome Page\" class=\"wp-image-90286\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/03\/angular-reactiveform-custom-validation-project-demo-guide-1.jpg 713w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/03\/angular-reactiveform-custom-validation-project-demo-guide-1-300x99.jpg 300w\" sizes=\"(max-width: 713px) 100vw, 713px\" \/><figcaption>Fig. 2: Welcome Page<\/figcaption><\/figure>\n<\/div>\n<p>A user can enter the details and if the confirm password field does not match the password, an error is shown.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" width=\"708\" height=\"258\" src=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/03\/angular-reactiveform-custom-validation-project-demo-guide-3.jpg\" alt=\"Angular 6 Reactive Forms Validation - Error Message\" class=\"wp-image-90287\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/03\/angular-reactiveform-custom-validation-project-demo-guide-3.jpg 708w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/03\/angular-reactiveform-custom-validation-project-demo-guide-3-300x109.jpg 300w\" sizes=\"(max-width: 708px) 100vw, 708px\" \/><figcaption>Fig. 3: Custom Validation Error Message<\/figcaption><\/figure>\n<\/div>\n<p>That is all for this tutorial and I hope the article served you whatever you were expecting for. Happy Learning and do not forget to share!<\/p>\n<h2>6. Conclusion<\/h2>\n<p>In this section, we learned how to create a simple form model, bind it to the HTML form using reactive form classes, and apply custom validations. Developers can download the sample application as an Eclipse project in the <a href=\"#projectDownload\">Downloads<\/a> section.<\/p>\n<h2><a name=\"projectDownload\"><\/a>7. Download the Eclipse Project<\/h2>\n<p>This was a tutorial of Custom Validations in Angular Reactive Form.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>You can download the full source code of this example here: <a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/03\/angular-reactive-form-custom-validations-assignment.zip\" target=\"_blank\" rel=\"noopener noreferrer\"><strong>Angular 6 Reactive Forms Validation Example<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Welcome readers, in this tutorial, we will learn the basic of Reactive Forms in angular and perform custom validations on the form. 1. Introduction In a web application, a form is a common approach that allows users to submit input and interact with the application. Frequently used for user login, information search, and feedback submission. &hellip;<\/p>\n","protected":false},"author":26931,"featured_media":49726,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1880],"tags":[740],"class_list":["post-90284","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-angular","tag-angular"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Angular 6 Reactive Forms Validation Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Interested to learn more about Angular 6? Then check out our detailed example on Angular 6 Reactive Forms Validation!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2019\/04\/angular-6-reactive-forms-validation-example.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Angular 6 Reactive Forms Validation Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Interested to learn more about Angular 6? Then check out our detailed example on Angular 6 Reactive Forms Validation!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2019\/04\/angular-6-reactive-forms-validation-example.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2019-04-04T10:00:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/angularjs-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Yatin Batra\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Yatin Batra\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/04\\\/angular-6-reactive-forms-validation-example.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/04\\\/angular-6-reactive-forms-validation-example.html\"},\"author\":{\"name\":\"Yatin Batra\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/cda31a4c1965373fed40c8907dc09b8d\"},\"headline\":\"Angular 6 Reactive Forms Validation Example\",\"datePublished\":\"2019-04-04T10:00:24+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/04\\\/angular-6-reactive-forms-validation-example.html\"},\"wordCount\":611,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/04\\\/angular-6-reactive-forms-validation-example.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2015\\\/12\\\/angularjs-logo.jpg\",\"keywords\":[\"Angular\"],\"articleSection\":[\"Angular\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/04\\\/angular-6-reactive-forms-validation-example.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/04\\\/angular-6-reactive-forms-validation-example.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/04\\\/angular-6-reactive-forms-validation-example.html\",\"name\":\"Angular 6 Reactive Forms Validation Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/04\\\/angular-6-reactive-forms-validation-example.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/04\\\/angular-6-reactive-forms-validation-example.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2015\\\/12\\\/angularjs-logo.jpg\",\"datePublished\":\"2019-04-04T10:00:24+00:00\",\"description\":\"Interested to learn more about Angular 6? Then check out our detailed example on Angular 6 Reactive Forms Validation!\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/04\\\/angular-6-reactive-forms-validation-example.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/04\\\/angular-6-reactive-forms-validation-example.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/04\\\/angular-6-reactive-forms-validation-example.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2015\\\/12\\\/angularjs-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2015\\\/12\\\/angularjs-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/04\\\/angular-6-reactive-forms-validation-example.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Web Development\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/web-development\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"JavaScript\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/web-development\\\/javascript\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Angular\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/web-development\\\/javascript\\\/angular\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Angular 6 Reactive Forms Validation Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/cda31a4c1965373fed40c8907dc09b8d\",\"name\":\"Yatin Batra\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/Yatin.batra_.jpg\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/Yatin.batra_.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/Yatin.batra_.jpg\",\"caption\":\"Yatin Batra\"},\"description\":\"An experience full-stack engineer well versed with Core Java, Spring\\\/Springboot, MVC, Security, AOP, Frontend (Angular &amp; React), and cloud technologies (such as AWS, GCP, Jenkins, Docker, K8).\",\"sameAs\":[\"https:\\\/\\\/www.javacodegeeks.com\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/yatin-batra\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Angular 6 Reactive Forms Validation Example - Java Code Geeks","description":"Interested to learn more about Angular 6? Then check out our detailed example on Angular 6 Reactive Forms Validation!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2019\/04\/angular-6-reactive-forms-validation-example.html","og_locale":"en_US","og_type":"article","og_title":"Angular 6 Reactive Forms Validation Example - Java Code Geeks","og_description":"Interested to learn more about Angular 6? Then check out our detailed example on Angular 6 Reactive Forms Validation!","og_url":"https:\/\/www.javacodegeeks.com\/2019\/04\/angular-6-reactive-forms-validation-example.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2019-04-04T10:00:24+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/angularjs-logo.jpg","type":"image\/jpeg"}],"author":"Yatin Batra","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Yatin Batra","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2019\/04\/angular-6-reactive-forms-validation-example.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/04\/angular-6-reactive-forms-validation-example.html"},"author":{"name":"Yatin Batra","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/cda31a4c1965373fed40c8907dc09b8d"},"headline":"Angular 6 Reactive Forms Validation Example","datePublished":"2019-04-04T10:00:24+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/04\/angular-6-reactive-forms-validation-example.html"},"wordCount":611,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/04\/angular-6-reactive-forms-validation-example.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/angularjs-logo.jpg","keywords":["Angular"],"articleSection":["Angular"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2019\/04\/angular-6-reactive-forms-validation-example.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2019\/04\/angular-6-reactive-forms-validation-example.html","url":"https:\/\/www.javacodegeeks.com\/2019\/04\/angular-6-reactive-forms-validation-example.html","name":"Angular 6 Reactive Forms Validation Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/04\/angular-6-reactive-forms-validation-example.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/04\/angular-6-reactive-forms-validation-example.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/angularjs-logo.jpg","datePublished":"2019-04-04T10:00:24+00:00","description":"Interested to learn more about Angular 6? Then check out our detailed example on Angular 6 Reactive Forms Validation!","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/04\/angular-6-reactive-forms-validation-example.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2019\/04\/angular-6-reactive-forms-validation-example.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2019\/04\/angular-6-reactive-forms-validation-example.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/angularjs-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/12\/angularjs-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2019\/04\/angular-6-reactive-forms-validation-example.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Web Development","item":"https:\/\/www.javacodegeeks.com\/category\/web-development"},{"@type":"ListItem","position":3,"name":"JavaScript","item":"https:\/\/www.javacodegeeks.com\/category\/web-development\/javascript"},{"@type":"ListItem","position":4,"name":"Angular","item":"https:\/\/www.javacodegeeks.com\/category\/web-development\/javascript\/angular"},{"@type":"ListItem","position":5,"name":"Angular 6 Reactive Forms Validation Example"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/cda31a4c1965373fed40c8907dc09b8d","name":"Yatin Batra","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/12\/Yatin.batra_.jpg","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/12\/Yatin.batra_.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/12\/Yatin.batra_.jpg","caption":"Yatin Batra"},"description":"An experience full-stack engineer well versed with Core Java, Spring\/Springboot, MVC, Security, AOP, Frontend (Angular &amp; React), and cloud technologies (such as AWS, GCP, Jenkins, Docker, K8).","sameAs":["https:\/\/www.javacodegeeks.com"],"url":"https:\/\/www.javacodegeeks.com\/author\/yatin-batra"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/90284","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/26931"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=90284"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/90284\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/49726"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=90284"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=90284"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=90284"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}