title: Dart: Wait for template to finish
body: <p>I have a HTML with some templates in it and a function which changes the template which is bound.
  The Function looks like this:</p>
  
  
  
  <pre class="lang-dart prettyprint-override"><code>void onHover(Event e, var detail, Node sender) {
      this.querySelector('#tempToBind').setAttribute("ref", "Btn2");
  
      this.querySelector('#Btn2').onMouseLeave.listen((e) {
      this.querySelector('#tempToBind').setAttribute("ref", "Btn1");
  }
  </code></pre>
  
  <p>Btn2 should be shown when the Mouse enters Btn1 and if the Mouse leaves Btn2, Btn1 should be shown again. If i query for Btn2 is always <code>null</code> and i guess its because the template has not finished loading.
  It there a way to get a callback, when the template finished loading?</p>
  
  <p>Templates look like this:</p>
  
  <pre class="lang-dart prettyprint-override"><code>&lt;template&gt;
  &lt;!-- some content here --&gt;
      &lt;template id="tempToBind" bind ref="Btn1"&gt;&lt;/template&gt;
  
  &lt;template&gt;
  
  &lt;template id="Btn1"&gt;
   &lt;div&gt;&lt;button&gt;1&lt;/button&gt;&lt;div&gt;
  &lt;/template&gt;
  &lt;template id="Btn2"&gt;
   &lt;div&gt;&lt;button&gt;2&lt;/button&gt;&lt;div&gt;
  &lt;/template&gt;
  </code></pre>