title: changing text on button while saving using Angularjs
body: <p>How do I change the text on a submit-button while saving data in a form?</p>
  
  <p>I have a button like this</p>
  
  <pre><code>&lt;button ng-click="save()"&gt;Save data&lt;/button&gt;
  </code></pre>
  
  <p>and I updated my save-function based on the answers below:</p>
  
  <pre><code>    $scope.ButtonText = "Save day";
      $scope.save=function(){
          $scope.ButtonText = "Saving day";
          for(var i=0;i&lt;days.length;i++)
          {
             MyService.saveday()
              .success(function(data, status, headers, config) {
              })
              .error(function(data, status, headers, config) {
              });
          }
         $scope.ButtonText = "Save day";
      };
  </code></pre>
  
  <p>While saving data, I would like to change the text from "Save data" to "Saving data" and back to "Save data" when the data has been saved. </p>
  
  <p><strong><em>UPDATE</em></strong></p>
  
  <p>I added </p>
  
  <pre><code> $scope.ButtonText = "Save day"; 
  </code></pre>
  
  <p>based on the answers below, but realized that my needs are more complex since I am calling an asynchronous service multiple times. So I guess the question is how I can set the text while the service is being called asynchronously and only revert it back to the original text, after all, calls to the service have finished executing.</p>
  
  <p>thanks</p>
  
  <p>Thomas</p>