title: how to clear modals in ionic angular todo example
body: <p>I've noticed that in the ionic todo app example the stale/old todo information remains on the modal if I cancel the modal and open it back up again.  What's the best place to clear/reset the old modal data so that it always has fresh blank fields after I cancel or submit the modal form fields?</p>
  
  <p>Should I null or clear the task object somehwere? Reset the fields manually on close and create?  Add a handler to some sort of on hide event?</p>
  
  <p>Here's the angular/ionic example:</p>
  
  <p><a href="http://ionicframework.com/docs/guide/building.html" rel="nofollow">http://ionicframework.com/docs/guide/building.html</a></p>
  
  <p>and a relevant snippet of code</p>
  
  <pre><code> // Called when the form is submitted
    $scope.createTask = function(task) {
      $scope.tasks.push({
        title: task.title
      });
      $scope.taskModal.hide();
      task.title = "";
    };
  
    // Open our new task modal
    $scope.newTask = function() {
      $scope.taskModal.show();
    };
  
    // Close the new task modal
    $scope.closeNewTask = function() {
      $scope.taskModal.hide();
    };
  </code></pre>
  
  <p>and the modal</p>
  
  <pre><code>&lt;div class="modal"&gt;
  
  &lt;!-- Modal header bar --&gt;
  &lt;ion-header-bar class="bar-secondary"&gt;
    &lt;h1 class="title"&gt;New Task&lt;/h1&gt;
    &lt;button class="button button-clear button-positive" ng-click="closeNewTask()"&gt;Cancel&lt;/button&gt;
  &lt;/ion-header-bar&gt;
  
  &lt;!-- Modal content area --&gt;
  &lt;ion-content&gt;
  
    &lt;form ng-submit="createTask(task)"&gt;
      &lt;div class="list"&gt;
        &lt;label class="item item-input"&gt;
          &lt;input type="text" placeholder="What do you need to do?" ng-model="task.title"&gt;
        &lt;/label&gt;
      &lt;/div&gt;
      &lt;div class="padding"&gt;
        &lt;button type="submit" class="button button-block button-positive"&gt;Create Task&lt;/button&gt;
      &lt;/div&gt;
    &lt;/form&gt;
  
  &lt;/ion-content&gt;
  </code></pre>
  
  <p></p>