title: AngularJS $setPristine with TypeScript: form is undefined
body: <p>When I try to use <code>form.$setPristine</code> from TypeScript, it doesn't work and the debug says <code>form</code> is undefined. According to what I read, <code>$scope.formName.$setPristine()</code> shall set the form to pristine. To access <code>$scope.formName</code> from the controller, I added it to my custom scope interface as an <code>ng.IFormController</code> property. However, when I call <code>$scope.form.$setPristine()</code>, it doesn't work, and debug shows <code>$scope.form</code> is undefined.</p>
  
  <p>TypeScript:</p>
  
  <pre><code>interface IMyScope extends ng.IScope {
      employees: Array&lt;IEmployee&gt;;
      employeeToAdd: IEmployee;
      addEmployee(): void;
      form: ng.IFormController;
  }
  
  class EmployeeAddController {
      static $inject = ['$scope', 'Employees'];
  
      constructor(
          $scope: IMyScope,
          $modalInstance: ng.ui.bootstrap.IModalServiceInstance,  
          Employees: IUpdateableResourceClass&lt;IUpdateableResource&gt;
      ) {
          $scope.employees = new Array&lt;IEmployee&gt;();
  
          $scope.employeeToAdd = {
              Name: '',
              Email: ''
          };
  
          $scope.addEmployee = function () {
              Employees.save(null, $scope.employeeToAdd, function (employee: IEmployee) {
                  $scope.employees.push(employee);
                  $scope.employeeToAdd.Email = '';
              $scope.employeeToAdd.Name = '';
                  $scope.form.$setPristine(); // $scope.form is undefined
              });
          };
      }
  } 
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;form role="form" class="form-inline" name="form"&gt;
      &lt;div class="form-group" ng-class="{ 'has-error': form.name.$dirty &amp;&amp; form.name.$invalid }"&gt;
          &lt;input type="text" class="form-control" ng-model="employeeToAdd.Name" name="name" required&gt;
      &lt;/div&gt;
      &lt;div class="form-group" ng-class="{ 'has-error': form.email.$dirty &amp;&amp; form.email.$invalid }"&gt;
          &lt;input type="email" class="form-control" ng-model="employeeToAdd.Email" name="email" required&gt;
      &lt;/div&gt;
      &lt;button type="button" class="btn btn-default" ng-click="addEmployee()" ng-disabled="form.$invalid"&gt;Add&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>