Sunday, 15 September 2013

javascript - Instantiate polymer-element only when needed? -


It seems that if I have & lt; Template id = "{{somecondition}}" & gt; .. & lt; / Template & gt; / P>

How to do this (indexing and triggering the events of life cycle on only a few things) or do I need to log in Have to Instant Using Javascript?

Thank you!

Yes, there are built-in ways in it here,

In the template, If you are passing some data, give a synthetic template dynamically imported elements in order to ensure that the data is binding after the element is registered. > & lt; Template if = "{{dynamic_element_registered}}" & gt; & Lt; My-dynamic_element categories_globals = {{categories_globals}} & gt; I'm just an unknown element & lt; / My- dynamic_element & gt; & Lt; / Template & gt;

In prototype:

  dynamic_load: function () {console.log ('dynamic_load'); Polymer.import (['my-dynamic_element.html'], function () {this.dynamic_element_registered = true;} .bind (this)); },  

No comments:

Post a Comment