title: angularJS Resetting $Scope Values On Button Click
body: <p>I have a AngularJS SPA what contains a text input on a modal, on Page load the modals inputs are set to their desired initial state through a scope function which is called. </p>
  
  <p><strong>Modal</strong>  </p>
  
  <pre><code>&lt;input class="form-control" ng-model="PatientName" name="PatientName" id="PatientName" /&gt;
  &lt;button type="button" class="btn btn-default" ng-click="setvals()" data-dismiss="modal"&gt;Close&lt;/button&gt;
  </code></pre>
  
  <p><strong>App.js</strong></p>
  
  <pre><code>var app = angular.module("TrollyPatientApp", ['TrollyPatientFilters']);
  
  app.controller("NewPartientModalController", function ($scope, $filter) {
      console.log("controller Loaded...")
      $scope.setvals = function () {
          console.log($scope);
          console.log("Setting Intial New Patient Values.")
          $scope.PatientName = "john";
          $scope.setDateAsNowCB = true; //True = Readonly, false = enabled.
          $scope.ArrivalDateInEd = $filter('date')(new Date(), 'dd/MM/yyyy');//Injecting the date (through the filter) into the ArrivalDateInED field.
          console.log($scope);
      }
  
      $scope.setvals();
  });
  </code></pre>
  
  <p>When the <code>close</code> button is clicked on the modal i want it to reset all the values back to default.</p>
  
  <p>At present it does this by calling <code>setvals()</code>. I can see it being called from the debug console however it doesn't seem to effect the input value....</p>