How do you update specific properties of a form model?
You can use patchValue()
method to update specific properties defined in the form model. For example,you can update the name and street of certain profile on click of the update button as shown below.
updateProfile() {this.userProfile.patchValue({firstName: 'John',address: {street: '98 Crescent Street'}});}
<button (click)="updateProfile()">Update Profile</button>
You can also use setValue
method to update properties.
Note: Remember to update the properties against the exact model structure.
May 08, 2022
194
Read more
What is Angular Framework?
November 04, 2022
AngularWhat is a Angular module?
November 03, 2022
AngularWhat are the steps to use animation module?
October 31, 2022
Angular