title: Close browser window in Angular SPA
body: <p>I've tried quite a few versions of the window.close() method trying to get around the "Scripts may not close windows that were not opened by script." error and have settled on the code below. I no longer receive the scripts error, but all the below does is redirect to my index page of my single page app.
  Does anyone have any thoughts or ideas?</p>
  
  <p>So I call it from this page (ng-click) <strong>/index.html#/complete</strong></p>
  
  <p>and it redirects me to <strong>/index.html#/</strong></p>
  
  <pre><code>$window.open($window.location.pathname, '_self').$window.close();
  </code></pre>