My form has an 'Address' section where I submit the data to the server using an $http post request.
If the address fields are left blank (pristine), then the Address information is not included in the object data sent to the server.
However, when I type something in the address fields and then delete what I typed (leaving them blank), empty fields are still included in the JSON post:
{
street:"",
city:""
}
I wish to exclude this optional address data if the fields are left blank.
Is there an easy way to reset individual form fields to their 'pristine' state if they remain empty?