title: Angular: always get popup blocker on create new tab after async call
body: <p>I have following scenario:</p>
  
  <ul>
  <li>User tries to login with wrong password</li>
  <li>on failure I ask him if he wants to reset password</li>
  <li>if user click 'OK' (pure <code>confirm dialog</code>) , I'll open new tab with some URL.</li>
  </ul>
  
  <p>My problem is: <strong>I always get  popup blocker</strong> because I generate <code>window</code> only after error callback. Here is relevant code <code>login</code> method:</p>
  
  <pre><code> $scope.login = function () {
  
              $auth.login({
                  email: $scope.fields.email,
                  password: $scope.fields.password
              })
                  .then(function () {
  
                          // ... login success
                  })
                  .catch(function () {
  
                    // login failed (my case)
  
                   if (confirm('ERROR: Invalid password, forgot Password? Click \'OK\' if you want to reset it')){
  
                     var url_ = 'http://meeter.me/#/forgot-pass/snaggs@gmail.com';
  
                      var myPopup = window.open ('',  '_blank');
  
  
                      myPopup.location = url_;
                      if (myPopup &amp;&amp; myPopup.focus) {
                        myPopup.focus();
                      }       
                   }// if
  
  
                  });
  
          };
  </code></pre>
  
  <p>If I move <code>var myPopup = window.open ('',  '_blank');</code> to next line under <code>$scope.login = function ()</code> it will work but it will open new empty tab.</p>
  
  <p>I want to open new tab only when get error on login</p>
  
  <p><em>I use <a href="https://github.com/sahat/satellizer" rel="nofollow">satellizer</a></em></p>
  
  <p>Please help,</p>
  
  <hr>
  
  <p><a href="http://plnkr.co/edit/qX69kUPcKTT2i7N3pNCD?p=preview" rel="nofollow">Plunker Demo</a></p>
  
  <p>In demo i use single <code>$timeout</code> to simulate async call</p>