title: $setPristine() not working in angular material form
body: <p>I am making a simple form in angular material to add a post , i also have a cancel button to clear the form . I tried using <strong>$setPristine()</strong> but still input field shows red after calling clearForm function . I followed some of the answers here but that did not solve my issue .
  here is my index.html and app.js</p>
  
  <pre><code>&lt;form id="addForm" name="myForm"&gt;
                  &lt;fieldset id="addField"&gt;
                      &lt;legend id="addFormLegend"&gt;Create Post&lt;/legend&gt;
                      &lt;md-input-container class="md-block"&gt;
  
                          &lt;md-icon md-svg-src="name.svg"&gt;&lt;/md-icon&gt;
                          &lt;input ng-model="post.name" type="text" placeholder="Name" ng-required="true"&gt;
                      &lt;/md-input-container&gt;
                      &lt;md-input-container class="md-block"&gt;
  
                          &lt;md-icon md-svg-src="desc.svg"&gt;&lt;/md-icon&gt;
                          &lt;input ng-model="post.desc" type="text" placeholder="Description" ng-required="true"&gt;
                      &lt;/md-input-container&gt;
                      &lt;md-input-container class="md-block"&gt;
  
                          &lt;md-icon md-svg-src="link.svg"&gt;&lt;/md-icon&gt;
                          &lt;input ng-model="post.url" type="url" placeholder="Url " ng-required="true"&gt;
                      &lt;/md-input-container&gt;
                      &lt;md-button ng-click="clearForm()" class="md-raised md-primary" id="cancelButton"&gt; Cancel &lt;/md-button&gt;
                      &lt;md-button ng-click="createPost(post)" class="md-raised md-primary" ng-disabled="myForm.$invalid" id="addButton"&gt; Add Post &lt;/md-button&gt;
                  &lt;/fieldset&gt;
  
              &lt;/form&gt;
  
  app.controller('mainCtrl', ['$scope', '$firebaseArray', 'posts', function ($scope, $firebaseArray, posts) {
          $scope.posts = posts;
          $scope.showForm = false;
          var defaultForm = {
              name: "",
              desc: "",
              url: ""
          };
          $scope.demo = {};
          $scope.post = angular.copy(defaultForm);
  
          $scope.createPost = function (post) {
              $scope.posts.$add({
                  name: post.name,
                  desc: post.desc,
                  url: post.url
              });
              $scope.post = {};
          };
          $scope.showAddForm = function () {
              $scope.showForm = true;
          };
          $scope.clearForm = function () {
              // $scope.showForm = false;
              $scope.myForm.$setPristine();
              $scope.post = angular.copy(defaultForm);
              console.log('empty');
  
  
          }
      }]);
  </code></pre>