title: Angular: Code execution in lambda does not affect the template
body: <p>I'm building app using Angular 2 and stumbled on this problem. When performing ajax call, we usually call them in this fashion:</p>
  
  <pre><code>http.post(this.baseUrl + url, data, { headers: headers}).subscribe(
      result =&gt; {
          this.showForm = false;
      },
      error =&gt; {
          this.showForm = true;
      }
  );
  </code></pre>
  
  <p>The <code>showForm</code> is a property of <code>Component</code> which indicate when to add/remove the form, i.e: by setting <code>*ngIf="showForm"</code>. If I executing that code, when the ajax call is success, the form will be removed from the DOM, and if the call is failed, the form stay. This is the correct behavior.</p>
  
  <p>Things a little different though, when I executing Facebook Login API. As per the tutorial said, the code should be like this:</p>
  
  <pre><code>FB.getLoginStatus(response =&gt; {
      if (response.status === 'connected') {
          this.showForm = false;
      }
      else {
          this.showForm = true;
      }
  });
  </code></pre>
  
  <p>When I executed that code, in the condition where the user already logged in to facebook and already signed in on the app (response.status is <code>'conencted'</code>), the code will be executing <code>this.showForm = false;</code> inside the response lambda. Following previous behavior, this should be removing the form from the DOM.I've tried to debug it on Chrome and <code>this.showForm = true;</code> was indeed executed.</p>
  
  <p>The problem is, although that line of code was executed, the form wasn't removed. Only when I execute this exact code twice or thrice, that the form finally notice the value changes and adjust the view accordingly. This makes the user need to click the facebook login button (which will call that <code>FB.getLoginStatus()</code>) twice or thrice, before he can actually signed in.</p>
  
  <p>Is there any fix on this? Or does my way of using <code>FB.getLoginStatus()</code> was wrong? I need some enlightenment here.</p>
  
  <p>EDIT:
  Fixing wrong executed code, where if response.status is <code>'conencted'</code>, the code will be executing <code>this.showForm = false;</code>, instead of <code>this.showForm = true;</code> which I previously wrote.</p>