PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, July 30, 2022

[FIXED] How to cancel validation in onValueChanged function in angular?

 July 30, 2022     angular, onchange, validation     No comments   

Issue

How to cancel validation in onValueChanged function in angular?

Here is demo

When I finish the form, I change the device value. You can see that a validation will be trigger in the apple phone. However, I set the validation in the field touched. I don't want to show this message while I click the device (onValueChanged function). It trigger the "touched" validation. Any one can help?


Solution

Why not change the form control to pristine and untouched. Then form validations will not show.

  deviceListOnChange(e) {
    this.updateForm.controls.apple.setValue(null);
    this.updateForm.controls.apple.markAsPristine();
    this.updateForm.controls.apple.markAsUntouched();
  }

stackblitz



Answered By - Naren Murali
Answer Checked By - Terry (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing