title: Replace entire DOM (page) with response from $http in AngularJS
body: <p>I have HTML AngualrJS application which works as follow:</p>
  
  <ol>
  <li>User types payment info on the form, form does not have action attribute set</li>
  <li>user clicks submit</li>
  <li>AngularJS intercepts data, processes payment and sends requests to server.</li>
  </ol>
  
  <p>This is where controller receives transaction confirmation details from my PHP:</p>
  
  <pre><code>this.stripeResponseHandler = function (status, response) {
  ...
  $http ({
          method: 'POST',
          url: 'https://server/billpay/charge.php',
          data: postData  
  }).then (function (response) {
          console.log (response.data);
          that.result = response.data;
          that.isSaving=1;
  }, function (response) {
          console.log ("failed %s", response);
          that.isSaving=1;
  })
  </code></pre>
  
  <p><strong>Problem:</strong></p>
  
  <p>I need to replace entire existing page (with the form) to the full HTML page (with CSS, HTML, JS) returned by the server. </p>
  
  <p>Server returns the receipt which user can just print for the records. </p>
  
  <p>Essentially I don't want to just inject server's response to DIV (or similar) on the current page, instead entire new page needs to be re-rendered from the server response.</p>
  
  <p>How would I do this?</p>
  
  <p>Thanks!!</p>