<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	
xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
>

<channel>
	<title>angular form - Bipon's Diary</title>
	<atom:link href="https://biponnotes.iglyphic.com/tag/angular-form/feed/" rel="self" type="application/rss+xml" />
	<link>https://biponnotes.iglyphic.com</link>
	<description>Do good for others. It will come back in unexpected ways.</description>
	<lastBuildDate>Mon, 06 Jan 2020 13:38:20 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.9.10</generator>
<site xmlns="com-wordpress:feed-additions:1">168324471</site>	<item>
		<title>Multiple Validators in Reactive Forms</title>
		<link>https://biponnotes.iglyphic.com/multiple-validators-in-reactive-forms/</link>
					<comments>https://biponnotes.iglyphic.com/multiple-validators-in-reactive-forms/#respond</comments>
		
		<dc:creator><![CDATA[bipon68]]></dc:creator>
		<pubDate>Mon, 06 Jan 2020 13:19:46 +0000</pubDate>
				<category><![CDATA[Angular Form]]></category>
		<category><![CDATA[angular form]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[reactive]]></category>
		<guid isPermaLink="false">https://bipon.me/?p=316</guid>

					<description><![CDATA[<p>profile.component.html profile.component.ts auth.service.ts user.module.ts user.routes.ts</p>
<p>The post <a href="https://biponnotes.iglyphic.com/multiple-validators-in-reactive-forms/">Multiple Validators in Reactive Forms</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><br>
<br>
<!--StartFragment--></p>


<p>profile.component.html</p>



<pre class="wp-block-code"><code>&lt;div>
  &lt;h1>Edit Your Profile &lt;/h1>
  &lt;hr>
  &lt;div class="col-md-4">
    &lt;form [formGroup]="profileForm" (ngSubmit)="saveProfile(profileForm.value)" autocomplete="off" novalidate>
      &lt;div class="form-group" [ngClass]="{'error' : !validateFirstName() }">
        &lt;label for="firstName">First Name:&lt;/label>
        &lt;em *ngIf="!validateFirstName() &amp;&amp; profileForm.controls.firstName.errors.required">Required&lt;/em>
        &lt;em *ngIf="!validateFirstName() &amp;&amp; profileForm.controls.firstName.errors.pattern">Must start with a letter&lt;/em>
        &lt;input formControlName="firstName" id="firstName" type="text" class="form-control" placeholder="First Name..." />
      &lt;/div>
      &lt;div class="form-group"  [ngClass]="{'error' : !validateLastName() }">
        &lt;label for="lastName">Last Name:&lt;/label>
        &lt;em *ngIf="!validateLastName()">Required&lt;/em>
        &lt;input formControlName="lastName" id="lastName" type="text" class="form-control" placeholder="Last Name..." />
      &lt;/div>

      &lt;button type="submit" class="btn btn-primary">Save&lt;/button>
      &lt;button type="button" class="btn btn-default" (click)="cancel()">Cancel&lt;/button>
    &lt;/form>
  &lt;div>
&lt;/div></code></pre>



<p>profile.component.ts</p>



<pre class="wp-block-code"><code>import { Component, OnInit } from '@angular/core'
import { FormControl, FormGroup, Validators } from '@angular/forms'
import { AuthService } from './auth.service'
import { Router} from '@angular/router'

@Component({
  templateUrl: './profile.component.html',
  styles: [`
    em {float:right; color:#E05C65; padding-left: 10px;}
    .error input {background-color:#E3C3C5;}
    .error ::-webkit-input-placeholder { color: #999; }
    .error ::-moz-placeholder { color: #999; }
    .error :-moz-placeholder { color:#999; }
    .error :ms-input-placeholder { color: #999; }
  `]
})
export class ProfileComponent implements OnInit {
  profileForm:FormGroup
  private firstName:FormControl
  private lastName:FormControl

  constructor(private router:Router, private authService:AuthService) {

  }

  ngOnInit() {
    this.firstName = new FormControl(this.authService.currentUser.firstName, [Validators.required, Validators.pattern('[a-zA-Z].*')])
    this.lastName = new FormControl(this.authService.currentUser.lastName, Validators.required)

    this.profileForm = new FormGroup({
      firstName: this.firstName,
      lastName: this.lastName
    })
  }

  saveProfile(formValues) {
    console.log('formValues : ', formValues);
    if (this.profileForm.valid) {
      this.authService.updateCurrentUser(formValues.firstName, formValues.lastName)
      this.router.navigate(['events'])
    }
  }

  validateFirstName() {
    return this.firstName.valid || this.firstName.untouched
  }
  
  validateLastName() {
    return this.lastName.valid || this.lastName.untouched
  }

  cancel() {
    this.router.navigate(['events'])
  }
       
}</code></pre>



<p>auth.service.ts </p>



<pre class="wp-block-code"><code>import { Injectable } from '@angular/core'
import { IUser } from './user.model'

@Injectable()
export class AuthService {

  currentUser:IUser
  
  loginUser(userName: string, password: string) {
    this.currentUser = {
      id: 1,
      userName: userName,
      firstName: 'Bipon',
      lastName: 'Biswas'
    }
  }

  isAuthenticated() {
    return !!this.currentUser;
  }

  updateCurrentUser(firstName:string, lastName:string) {
    this.currentUser.firstName = firstName
    this.currentUser.lastName = lastName
  }
}</code></pre>



<p>user.module.ts</p>



<pre class="wp-block-code"><code>import { NgModule } from '@angular/core'
import { CommonModule } from '@angular/common'
import { RouterModule } from '@angular/router'
import { FormsModule, ReactiveFormsModule } from '@angular/forms'

import { userRoutes } from './user.routes'
import { ProfileComponent } from './profile.component'
import { LoginComponent } from './login.component'

@NgModule({
  imports: [
    CommonModule,
    FormsModule,
    ReactiveFormsModule,
    RouterModule.forChild(userRoutes)
  ],
  declarations: [
    ProfileComponent,
    LoginComponent
  ],
  providers: [

  ]
})
export class UserModule { }</code></pre>



<p>user.routes.ts</p>



<pre class="wp-block-code"><code>import { ProfileComponent } from './profile.component'
import { LoginComponent } from './login.component'

export const userRoutes = [
  {path: 'profile', component: ProfileComponent},
  {path: 'login', component: LoginComponent}
]</code></pre>


<p><!--EndFragment--><br>
<br>
</p><p>The post <a href="https://biponnotes.iglyphic.com/multiple-validators-in-reactive-forms/">Multiple Validators in Reactive Forms</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://biponnotes.iglyphic.com/multiple-validators-in-reactive-forms/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">316</post-id>	</item>
		<item>
		<title>Validating Reactive Forms</title>
		<link>https://biponnotes.iglyphic.com/validating-reactive-forms/</link>
					<comments>https://biponnotes.iglyphic.com/validating-reactive-forms/#respond</comments>
		
		<dc:creator><![CDATA[bipon68]]></dc:creator>
		<pubDate>Mon, 06 Jan 2020 10:01:44 +0000</pubDate>
				<category><![CDATA[Angular Form]]></category>
		<category><![CDATA[angular form]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[reactive]]></category>
		<guid isPermaLink="false">https://bipon.me/?p=314</guid>

					<description><![CDATA[<p>profile.component.html profile.component.ts auth.service.ts user.module.ts user.routes.ts</p>
<p>The post <a href="https://biponnotes.iglyphic.com/validating-reactive-forms/">Validating Reactive Forms</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>profile.component.html</p>



<pre class="wp-block-code"><code>&lt;div>
  &lt;h1>Edit Your Profile &lt;/h1>
  &lt;hr>
  &lt;div class="col-md-4">
    &lt;form [formGroup]="profileForm" (ngSubmit)="saveProfile(profileForm.value)" autocomplete="off" novalidate>
      &lt;div class="form-group" [ngClass]="{'error' : !validateFirstName() }">
        &lt;label for="firstName">First Name:&lt;/label>
        &lt;em *ngIf="!validateFirstName()">Required&lt;/em>
        &lt;input formControlName="firstName" id="firstName" type="text" class="form-control" placeholder="First Name..." />
      &lt;/div>
      &lt;div class="form-group"  [ngClass]="{'error' : !validateLastName() }">
        &lt;label for="lastName">Last Name:&lt;/label>
        &lt;em *ngIf="!validateLastName()">Required&lt;/em>
        &lt;input formControlName="lastName" id="lastName" type="text" class="form-control" placeholder="Last Name..." />
      &lt;/div>

      &lt;button type="submit" class="btn btn-primary">Save&lt;/button>
      &lt;button type="button" class="btn btn-default" (click)="cancel()">Cancel&lt;/button>
    &lt;/form>
  &lt;div>
&lt;/div></code></pre>



<p>profile.component.ts</p>



<pre class="wp-block-code"><code>import { Component, OnInit } from '@angular/core'
import { FormControl, FormGroup, Validators } from '@angular/forms'
import { AuthService } from './auth.service'
import { Router} from '@angular/router'

@Component({
  templateUrl: './profile.component.html',
  styles: [`
    em {float:right; color:#E05C65; padding-left: 10px;}
    .error input {background-color:#E3C3C5;}
    .error ::-webkit-input-placeholder { color: #999; }
    .error ::-moz-placeholder { color: #999; }
    .error :-moz-placeholder { color:#999; }
    .error :ms-input-placeholder { color: #999; }
  `]
})
export class ProfileComponent implements OnInit {
  profileForm:FormGroup
  private firstName:FormControl
  private lastName:FormControl

  constructor(private router:Router, private authService:AuthService) {

  }

  ngOnInit() {
    this.firstName = new FormControl(this.authService.currentUser.firstName, Validators.required)
    this.lastName = new FormControl(this.authService.currentUser.lastName, Validators.required)

    this.profileForm = new FormGroup({
      firstName: this.firstName,
      lastName: this.lastName
    })
  }

  saveProfile(formValues) {
    console.log('formValues : ', formValues);
    if (this.profileForm.valid) {
      this.authService.updateCurrentUser(formValues.firstName, formValues.lastName)
      this.router.navigate(['events'])
    }
  }

  validateFirstName() {
    return this.firstName.valid || this.firstName.untouched
  }
  
  validateLastName() {
    return this.lastName.valid || this.lastName.untouched
  }

  cancel() {
    this.router.navigate(['events'])
  }
       
}</code></pre>



<p>auth.service.ts </p>



<pre class="wp-block-code"><code>import { Injectable } from '@angular/core'
import { IUser } from './user.model'

@Injectable()
export class AuthService {

  currentUser:IUser
  
  loginUser(userName: string, password: string) {
    this.currentUser = {
      id: 1,
      userName: userName,
      firstName: 'Bipon',
      lastName: 'Biswas'
    }
  }

  isAuthenticated() {
    return !!this.currentUser;
  }

  updateCurrentUser(firstName:string, lastName:string) {
    this.currentUser.firstName = firstName
    this.currentUser.lastName = lastName
  }
}</code></pre>



<p>user.module.ts</p>



<pre class="wp-block-code"><code>import { NgModule } from '@angular/core'
import { CommonModule } from '@angular/common'
import { RouterModule } from '@angular/router'
import { FormsModule, ReactiveFormsModule } from '@angular/forms'

import { userRoutes } from './user.routes'
import { ProfileComponent } from './profile.component'
import { LoginComponent } from './login.component'

@NgModule({
  imports: [
    CommonModule,
    FormsModule,
    ReactiveFormsModule,
    RouterModule.forChild(userRoutes)
  ],
  declarations: [
    ProfileComponent,
    LoginComponent
  ],
  providers: [

  ]
})
export class UserModule { }</code></pre>



<p>user.routes.ts</p>



<pre class="wp-block-code"><code>import { ProfileComponent } from './profile.component'
import { LoginComponent } from './login.component'

export const userRoutes = [
  {path: 'profile', component: ProfileComponent},
  {path: 'login', component: LoginComponent}
]</code></pre><p>The post <a href="https://biponnotes.iglyphic.com/validating-reactive-forms/">Validating Reactive Forms</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://biponnotes.iglyphic.com/validating-reactive-forms/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">314</post-id>	</item>
		<item>
		<title>Creating Your First Reactive Form</title>
		<link>https://biponnotes.iglyphic.com/creating-your-first-reactive-form/</link>
					<comments>https://biponnotes.iglyphic.com/creating-your-first-reactive-form/#respond</comments>
		
		<dc:creator><![CDATA[bipon68]]></dc:creator>
		<pubDate>Mon, 06 Jan 2020 09:46:04 +0000</pubDate>
				<category><![CDATA[Angular Form]]></category>
		<category><![CDATA[angular form]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[reactive]]></category>
		<guid isPermaLink="false">https://bipon.me/?p=312</guid>

					<description><![CDATA[<p>profile.component.html profile.component.ts auth.service.ts app.module.ts</p>
<p>The post <a href="https://biponnotes.iglyphic.com/creating-your-first-reactive-form/">Creating Your First Reactive Form</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>profile.component.html</p>



<pre class="wp-block-code"><code>&lt;div>
    &lt;h1>Edit Your Profile &lt;/h1>
    &lt;hr>
    &lt;div class="col-md-4">
      &lt;form [formGroup]="profileForm" (ngSubmit)="saveProfile(profileForm.value)" autocomplete="off" novalidate>
        &lt;div class="form-group">
          &lt;label for="firstName">First Name:&lt;/label>
          &lt;input formControlName="firstName" id="firstName" type="text" class="form-control" placeholder="First Name..." />
        &lt;/div>
        &lt;div class="form-group">
          &lt;label for="lastName">Last Name:&lt;/label>
          &lt;input formControlName="lastName" id="lastName" type="text" class="form-control" placeholder="Last Name..." />
        &lt;/div>
  
        &lt;button type="submit" class="btn btn-primary">Save&lt;/button>
        &lt;button type="button" class="btn btn-default" (click)="cancel()">Cancel&lt;/button>
      &lt;/form>
    &lt;/div>
  &lt;/div></code></pre>



<p>profile.component.ts</p>



<pre class="wp-block-code"><code>import { AuthService } from './auth.service';
import { Component, OnInit } from '@angular/core'
import { FormControl, FormGroup } from '@angular/forms'
import { Router } from '@angular/router';

@Component({
  templateUrl: './profile.component.html',
})
export class ProfileComponent implements OnInit{

  profileForm: FormGroup

  constructor(private authService: AuthService, private router: Router){}

  ngOnInit(){
    let firstName = new FormControl(this.authService.currentUser.firstName)
    let lastName = new FormControl(this.authService.currentUser.lastName)
    this.profileForm = new FormGroup({
      firstName: firstName,
      lastName: lastName
    })
  }

  cancel(){
    this.router.navigate(['events'])
  }
  saveProfile(formValues){
    this.authService.updateCurrentUser(formValues.firstName, formValues.lastName)
  }     
}</code></pre>



<p>auth.service.ts</p>



<pre class="wp-block-code"><code>import { Injectable } from '@angular/core';
import { IUser } from './user.model';


@Injectable()
export class AuthService{

    currentUser: IUser;
    //debugger;
    loginUser(userName: string, password: string){
        this.currentUser = {
            id: 1,
            userName: userName,
            firstName: 'Bipon',
            lastName: 'Biswas'
        }
    }
    isAuthenticated(){
        return !this.currentUser;
    }
    updateCurrentUser(firstName:string, lastName: string){
        this.currentUser.firstName = firstName
        this.currentUser.lastName = lastName
    }

}</code></pre>



<p>app.module.ts </p>



<pre class="wp-block-code"><code>import { ProfileComponent } from './profile.component';
import { NgModule } from '@angular/core'
import { CommonModule } from '@angular/common'
import { RouterModule } from '@angular/router'
import { userRoutes } from './user.routes'
import { LoginComponent } from './login.component';
import { FormsModule, ReactiveFormsModule } from '@angular/forms'

@NgModule({
    imports: [
        CommonModule,
        FormsModule,
        ReactiveFormsModule,
        RouterModule.forChild(userRoutes)
    ],
    declarations: [
        ProfileComponent,
        LoginComponent
    ],
    providers: [

    ]

})
export class UserModule{

}</code></pre><p>The post <a href="https://biponnotes.iglyphic.com/creating-your-first-reactive-form/">Creating Your First Reactive Form</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://biponnotes.iglyphic.com/creating-your-first-reactive-form/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">312</post-id>	</item>
		<item>
		<title>Creating Your First Template based Form</title>
		<link>https://biponnotes.iglyphic.com/creating-your-first-template-based-form/</link>
					<comments>https://biponnotes.iglyphic.com/creating-your-first-template-based-form/#respond</comments>
		
		<dc:creator><![CDATA[bipon68]]></dc:creator>
		<pubDate>Fri, 03 Jan 2020 04:58:37 +0000</pubDate>
				<category><![CDATA[Angular Form]]></category>
		<category><![CDATA[angular form]]></category>
		<category><![CDATA[Component]]></category>
		<category><![CDATA[form]]></category>
		<guid isPermaLink="false">https://bipon.me/?p=307</guid>

					<description><![CDATA[<p>Step 1: Create a component like login.component.html Step 2: login.component.ts</p>
<p>The post <a href="https://biponnotes.iglyphic.com/creating-your-first-template-based-form/">Creating Your First Template based Form</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Step 1: Create a component like login.component.html</p>



<pre class="wp-block-code"><code>&lt;h1>Login&lt;/h1>
&lt;hr>
&lt;div class="col-md-4">
  &lt;form #loginForm="ngForm" (ngSubmit)="login(loginForm.value)" autocomplete="off">
    &lt;div class="form-group" >
      &lt;label for="userName">User Name:&lt;/label>
      &lt;input (ngModel)="userName" name="userName" id="userName" type="text" class="form-control" placeholder="User Name..." />
    &lt;/div>
    &lt;div class="form-group" >
      &lt;label for="password">Password:&lt;/label>
      &lt;input (ngModel)="password" name="password" id="password" type="password" class="form-control"placeholder="Password..." />
    &lt;/div>
        
    &lt;button type="submit" class="btn btn-primary">Login&lt;/button>
    &lt;button type="button" class="btn btn-default">Cancel&lt;/button>
  &lt;/form>
&lt;/div>
&lt;!-- {{loginForm.value | json}} --></code></pre>



<p>Step 2: login.component.ts</p>



<pre class="wp-block-code"><code>import { Component } from '@angular/core'

@Component({
    templateUrl: './login.component.html'
})

export class LoginComponent{

    userName
    password
    
    login(formValues){
        console.log(formValues)
    }

}</code></pre><p>The post <a href="https://biponnotes.iglyphic.com/creating-your-first-template-based-form/">Creating Your First Template based Form</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://biponnotes.iglyphic.com/creating-your-first-template-based-form/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">307</post-id>	</item>
		<item>
		<title>Submitting form with class binding in Angular</title>
		<link>https://biponnotes.iglyphic.com/submitting-form-with-class-binding-in-angular/</link>
					<comments>https://biponnotes.iglyphic.com/submitting-form-with-class-binding-in-angular/#respond</comments>
		
		<dc:creator><![CDATA[bipon68]]></dc:creator>
		<pubDate>Thu, 12 Dec 2019 12:39:38 +0000</pubDate>
				<category><![CDATA[Angular]]></category>
		<category><![CDATA[angular]]></category>
		<category><![CDATA[angular form]]></category>
		<category><![CDATA[form]]></category>
		<guid isPermaLink="false">https://bipon.me/?p=195</guid>

					<description><![CDATA[<p>Step 1: user-settings-form.component.html file Step 2: user-settings-form.component.ts file Step 3: user-settings-form.component.css file</p>
<p>The post <a href="https://biponnotes.iglyphic.com/submitting-form-with-class-binding-in-angular/">Submitting form with class binding in Angular</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><strong>Step 1:</strong> user-settings-form.component.html file</p>



<pre class="wp-block-code"><code>&lt;form #form="ngForm" (ngSubmit)="onSubmit(form)">
    &lt;div class="form-group">
        &lt;label for="name">Name&lt;/label>
        &lt;input id="name" name="name" class="form-control" [(ngModel)]="userSettings.name" required #nameField="ngModel"
          [class.field-error]="form.submitted &amp;&amp; nameField.invalid"/>
    &lt;/div>
	&lt;button class="btn btn-primary">Send&lt;/button>
&lt;/form></code></pre>



<p><strong>Step 2:</strong> user-settings-form.component.ts file</p>



<pre class="wp-block-code"><code>import { NgForm, NgModel } from '@angular/forms';  
onSubmit(form: NgForm){
    console.log('in onSubmmit: ', form.valid);       
  }</code></pre>



<p><strong>Step 3:</strong> user-settings-form.component.css file</p>



<pre class="wp-block-code"><code>.field-error{
    border: 1px solid red;
}</code></pre><p>The post <a href="https://biponnotes.iglyphic.com/submitting-form-with-class-binding-in-angular/">Submitting form with class binding in Angular</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://biponnotes.iglyphic.com/submitting-form-with-class-binding-in-angular/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">195</post-id>	</item>
		<item>
		<title>Styling forms with Validation errors in Angular</title>
		<link>https://biponnotes.iglyphic.com/styling-forms-with-validation-errors/</link>
					<comments>https://biponnotes.iglyphic.com/styling-forms-with-validation-errors/#respond</comments>
		
		<dc:creator><![CDATA[bipon68]]></dc:creator>
		<pubDate>Thu, 12 Dec 2019 12:27:50 +0000</pubDate>
				<category><![CDATA[Angular]]></category>
		<category><![CDATA[angular]]></category>
		<category><![CDATA[angular form]]></category>
		<guid isPermaLink="false">https://bipon.me/?p=191</guid>

					<description><![CDATA[<p>Step 1: user-settings-form.component.html file Step 2: user-settings-form.component.css file</p>
<p>The post <a href="https://biponnotes.iglyphic.com/styling-forms-with-validation-errors/">Styling forms with Validation errors in Angular</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><strong>Step 1:</strong> user-settings-form.component.html file</p>



<pre class="wp-block-code"><code>&lt;form #form="ngForm" ngNativeValidate">
    &lt;div class="form-group">
        &lt;label for="name">Name&lt;/label>
        &lt;input id="name" name="name" class="form-control" [(ngModel)]="userSettings.name" required #nameField="ngModel"/>
		  &lt;div *ngIf="!nameField.valid &amp;&amp;  nameField.touched"
            class="alert alert-danger">
            Enter a name
          &lt;/div>
    &lt;/div>
	&lt;button class="btn btn-primary">Send&lt;/button>
&lt;/form></code></pre>



<p><strong>Step 2:</strong> user-settings-form.component.css file</p>



<pre class="wp-block-code"><code>.ng-invalid:not(form).ng-touched{
    border: 1px solid red;
}</code></pre><p>The post <a href="https://biponnotes.iglyphic.com/styling-forms-with-validation-errors/">Styling forms with Validation errors in Angular</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://biponnotes.iglyphic.com/styling-forms-with-validation-errors/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">191</post-id>	</item>
		<item>
		<title>HTML5 Field Validation in Angular</title>
		<link>https://biponnotes.iglyphic.com/html5-field-validation-in-angular/</link>
					<comments>https://biponnotes.iglyphic.com/html5-field-validation-in-angular/#respond</comments>
		
		<dc:creator><![CDATA[bipon68]]></dc:creator>
		<pubDate>Thu, 12 Dec 2019 09:48:35 +0000</pubDate>
				<category><![CDATA[Angular]]></category>
		<category><![CDATA[angular]]></category>
		<category><![CDATA[angular form]]></category>
		<category><![CDATA[form]]></category>
		<guid isPermaLink="false">https://bipon.me/?p=180</guid>

					<description><![CDATA[<p>HTML 5 Validation Attributes required pattern minlength maxlength min max Step 1: user-settings-form.component.html file Step 2: user-settings-form.component.html file Step 3: user-settings-form.component.html file Step 4: user-settings-form.component.html file</p>
<p>The post <a href="https://biponnotes.iglyphic.com/html5-field-validation-in-angular/">HTML5 Field Validation in Angular</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><strong>HTML 5 Validation Attributes</strong></p>



<ul><li>required</li><li>pattern</li><li>minlength</li><li>maxlength</li><li>min</li><li>max</li></ul>



<p><strong>Step 1:</strong> user-settings-form.component.html file</p>



<pre class="wp-block-code"><code>&lt;form #form="ngForm" ngNativeValidate>
    &lt;div class="form-group">
        &lt;label for="name">Name&lt;/label>
        &lt;input id="name" name="name" class="form-control"  required />
        &lt;button class="btn btn-primary">Send&lt;/button>
     &lt;/div>
&lt;/form></code></pre>



<p><strong>Step 2:</strong> user-settings-form.component.html file</p>



<pre class="wp-block-code"><code>&lt;form #form="ngForm" ngNativeValidate>
    &lt;div class="form-group">
        &lt;label for="name">Name&lt;/label>
        &lt;input id="name" name="name" class="form-control"  pattern="B.*" />
   &lt;div>
    &lt;button class="btn btn-primary">Send&lt;/button>
&lt;/form>
</code></pre>



<p><strong>Step 3:</strong> user-settings-form.component.html file </p>



<pre class="wp-block-code"><code>&lt;form #form="ngForm" ngNativeValidate>
    &lt;div class="form-group">
        &lt;label for="name">Name&lt;/label>
        &lt;input id="name" name="name" class="form-control"  minlength="3" />
   &lt;div>
    &lt;button class="btn btn-primary">Send&lt;/button>
&lt;/form></code></pre>



<p><strong>Step 4:</strong> user-settings-form.component.html file  </p>



<pre class="wp-block-code"><code>&lt;form #form="ngForm" ngNativeValidate>
    &lt;div class="form-group">
        &lt;label for="name">Name&lt;/label>
        &lt;input id="name" name="name" class="form-control" type="number" min="3" max="300" />
   &lt;div>
    &lt;button class="btn btn-primary">Send&lt;/button>
&lt;/form></code></pre><p>The post <a href="https://biponnotes.iglyphic.com/html5-field-validation-in-angular/">HTML5 Field Validation in Angular</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://biponnotes.iglyphic.com/html5-field-validation-in-angular/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">180</post-id>	</item>
		<item>
		<title>Angular Form Technologies</title>
		<link>https://biponnotes.iglyphic.com/angular-form-technologies/</link>
					<comments>https://biponnotes.iglyphic.com/angular-form-technologies/#respond</comments>
		
		<dc:creator><![CDATA[bipon68]]></dc:creator>
		<pubDate>Wed, 11 Dec 2019 05:31:35 +0000</pubDate>
				<category><![CDATA[Angular]]></category>
		<category><![CDATA[Angular Form]]></category>
		<category><![CDATA[angular]]></category>
		<category><![CDATA[angular form]]></category>
		<category><![CDATA[form]]></category>
		<guid isPermaLink="false">https://bipon.me/?p=163</guid>

					<description><![CDATA[<p>Template-driven Forms Use a Component&#8217;s Template Unit Test Against DOM Reactive Forms Use a Component&#8217;s Template Create a Form Model in Typescript (this must by in sync with the template) Unit Test Against Form Model Validation in Form Model</p>
<p>The post <a href="https://biponnotes.iglyphic.com/angular-form-technologies/">Angular Form Technologies</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></description>
										<content:encoded><![CDATA[<h4>Template-driven Forms</h4>



<ul><li>Use a Component&#8217;s Template</li><li>Unit Test Against DOM</li></ul>



<h4>Reactive Forms</h4>



<ul><li>Use a Component&#8217;s Template</li><li>Create a Form Model in Typescript (this must by in sync with the template)</li><li>Unit Test Against Form Model</li><li>Validation in Form Model</li></ul><p>The post <a href="https://biponnotes.iglyphic.com/angular-form-technologies/">Angular Form Technologies</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://biponnotes.iglyphic.com/angular-form-technologies/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">163</post-id>	</item>
	</channel>
</rss>
