How to import template in polymer? -



How to import template in polymer? -

i want create template libraray in isolated file.

./my-components/templates.html

<template id="overtemplate"> <div on-mouseover="{{mouseoverhandler}}">over</div> </template> .....

and connect file in polymer-element:

<link rel="import" href="./my-components/templates.html">

then utilize template:

<template bind ref="overtemplate"></template>

how it?

how about?

var link = document.queryselector('link[rel=import]'); var content = link.import.queryselector('#overtemplate'); document.body.appendchild(document.importnode(content, true));

credits mr 'polymer' dodson... http://robdodson.me/blog/2013/08/20/exploring-html-imports/

polymer has helper called import far can tell ready import polymer-elements only.

polymer

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -