Validate special characters in angular

Discussão em 'Angular' iniciado por Expert Labs, Novembro 29, 2024.

  1. Expert Labs

    Expert Labs Guest

    ngOnInit(): void {
    this.customerForm = this.fb.group({
    name: ['', Validators.required],
    customer_id: ['', Validators.required],
    })
    }


    I have this form group in angular. So This a form which contains name and customer_id. What I need is that I want to validate the name field.It shouldn't accept any special characters. If possible please mention also to mention in using toastr

    <td>
    <mat-form-field>
    <mat-label>Name</mat-label>
    <input matInput placeholder="Name" formControlName="name" autocomplete="off" required>
    </mat-form-field>
    </td>

    Continue reading...

Compartilhe esta Página