Hi,
I have Syncfusion grid and email column and I need to add Angular email validator to it. It is a template driven form so I am using <input type="email" name="email" [email]="true"> as mentioned in below link.
https://angular.io/api/forms/EmailValidator
A. Syncfusion grid control - template driven form
<ejs-grid #grid id='{{data.id}}' [dataSource]='data.content' [pageSettings]='pageSettings' [allowSorting]="true" [editSettings]='editSettings'
[toolbar]='toolbar' height='100%' (actionBegin)='actionBegin($event)' (toolbarClick)="onToolbarClick($event, grid)">
<e-columns>
<e-column field='notificationId' [visible]='false' isPrimaryKey="true" isIdentity="true">e-column>
<e-column field='firstName' headerText='First Name' width='140' [validationRules]="firstNameRules" [edit]="nameEditCell">e-column>
<e-column field='lastName' headerText='Last Name' width='140' [validationRules]="lastNameRules" [edit]="nameEditCell">e-column>
<e-column field="email" headerText="Email" width='140'>
<ng-template #editTemplate let-data>
<input id="email" name="email" type="email" class="e-field e-input"
aria-labelledby="grid" [(ngModel)]="data.email" [email]="true" />
ng-template>
e-column>
<e-column field="processType" [visible]='false' defaultValue="{{data.header}}">e-column>
e-columns>
ejs-grid>
B. It is not a grid and is model-driven form.
There are Add/edit screens in my application that do not have grid and are model driven forms. We use Validators.Email Angular email validator on these screens.
emailAddress: this.formBuilder.control(this.household.emailAddress, { validators: Validators.email }),
We want to be consistent with email validation rules across the application.
But we noticed that if we enter this in email field "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa123@aaaa88aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaatest.cooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooom"
Sync fusion grid template driven form returns this as invalid email but model-driven form that use Validators.email return this as valid email. In both cases I am using Angular Email validator but not sure why validation rules differ.
Please let me know.
Thanks,
Pavani