I'm simply trying to reset a form using the angular functions **$setPristine** & **$setUntouched** (several forms are created with ng-repeat).  

I assign the form name dynamically by using the syntax **{{ someName }}** (the name is build on the server side and is passed as json (string)).  

The name of the form is correctly assigned in the markup and validations are working as expected. The problem arrises when I pass that name as a parameter in the ng-click="reset(someName)" function.  

When debugging the name comes as a string and not as the form object which causes the error. I did a quick test by hard-coding the name and pass that same name and it works fine.  

My assumption is, the name coming from json is a string and the type is forwarded to the function as is, instead of the object.  

So the question is: is there a way to convert that name so it is interpretated correctly by the controller. Or maybe there is something else I'm missing...

Here is the markup ( notice the name of the form uses {{ resto.contactForm }} ):

```
<form novalidate name="{{ resto.contactForm }}" ng-submit="submit(restoContact, resto.contactForm.$valid)" class="sky-form">
  <div class="form-group">
    <label class="checkbox state-success">
      <input type="checkbox" ng-model="restoContact.sameAsUser" name="sameAsUser" id="sameAsUser" value="true" ng-click="contactAutoFill()"><i></i>Contact name is same as current user.
      <input type="hidden" name="sameAsUser" value="false" />
    </label>
  </div>
  <div class="form-group">
     <label class="control-label" for="contactName">Contact Name</label>
     <input type="text" ng-model="restoContact.contactName" name="contactName" id="contactName" placeholder="John, Doe" class="form-control" required />
       <div ng-show="{{ resto.contactForm }}.contactName.$error.required && !{{ resto.contactForm }}.contactName.$pristine" class="note note-error">Please enter a name or check the box 'Same as current user'.</div>
   </div>
   <div class="form-group">
     <label class="control-label" for="contactPhoneNumber">Contact Phone Number</label>
     <input type="text" ng-model="restoContact.contactPhoneNumber" name="contactPhoneNumber" id="contactPhoneNumber" placeholder="+1 555-1234-567" class="form-control" required ng-pattern="phoneNumberPattern" />
       <div ng-show="({{ resto.contactForm }}.contactPhoneNumber.$error.required || {{ resto.contactForm }}.contactPhoneNumber.$error.pattern) && !{{ resto.contactForm }}.contactPhoneNumber.$pristine" class="note note-error">Please enter a valid phone number.</div>
    </div>
    <div class="margin-leftM19">
      <button class="btn btn-primary">Save Changes </button>
      <button class="btn btn-default" ng-click="reset(resto.contactForm)">Cancel </button>
    </div>
</form>

```

Here is the reset function in the controller (form comes as "contactForm1" which is the correct name but is a string and not the object):

```
$scope.reset = function (form) {            
        if (form) {
            form.$setPristine();
            form.$setUntouched();
        }
        //$scope.user = angular.copy($scope.master);
    };

```

I have not implemented th submit method but I'm sure I will be running into the same issue.
Any suggestions or advices are welcome.
Thanks in advance...

Here is the fidle.js. the variable data is an exact response from the server.  

[<http://jsfiddle.net/bouchepat/v0mtbxep/]>  

**SOLUTION**:  

<http://jsfiddle.net/bouchepat/v0mtbxep/3/>

I removed $setUntouched as it throws an error.