title: How Do I Defer Polymer Binding?
body: <p>So, a foreword - I am coming from using Angular. In Angular, you tend to use a lot of promises. Obviously Polymer does not prevent you from using an external promise library, however it is clearly built around classic event firing / callbacks. So, I am essentially trying to find a way to run logic in elements only once their wrapping element has reached a condition. </p>
  
  <p>I have an element named Secure-Page. This element can manipulate an external session object to tell it whether a user has logged in, and it performs login dialog functionality if the user is not logged in when they arrive on it. This element was created to gate pages on the client side if the user is attempting to access them without logging in. Basically it just prevents sending a bunch of failing ajax requests... in theory.</p>
  
  <p>In practice, I cannot find a simple way to have it prevent wrapped elements from loading / firing. I thought that using a conditional binding template would work, but it seems that the <code>ready</code>, <code>attached</code> and etc callbacks are being called whether the template is rendered or not.</p>
  
  <p>Example code:</p>
  
  <pre><code>// in secure-page.html
   &lt;template if="{{session.UserId &amp;&amp; session.token}}"&gt;
    &lt;content&gt;
    &lt;/content&gt;
   &lt;/template&gt;
  
  // in my-account.html
    &lt;ac-crud id="http"
        session="{{session}}"
        endpoint="http://localhost:3000/api/v1/users"
        on-get-complete="{{updateData}}"
        on-put-complete="{{handleSuccess}}"
        &gt;&lt;/ac-crud&gt;
  ....
  &lt;script&gt;
  Polymer('my-account', {
  
   // even if I try any of the other callbacks all of them
   // are called even if the element is not rendered
   ready: function() {
     this.$.http.get({ params: { id: this.session.UserId } });
   }
  </code></pre>
  
  <p>...
      </p>
  
  <p>I have not included the whole script files, but I don't think the rest are relevant. </p>
  
  <p><strong>TLDR: I think I need a callback similar to ready, which is triggered when the element's template is actually bound. (Assuming that I am correct in thinking that so-called 'conditionally binding' templates actually do not bind until their conditions are met)</strong></p>