I saw an example in the docs using the ref attribute of template. I want to do the same thing using custom elements.
I know this syntax won't work but it should convey the general idea of what I am trying to do:
<{{node.nodeType }} node={{node}}>
In my old GWT app I had a strategy function for this purpose:
NodeRenderer r = determineNodeRenderer(node.nodeType )
r.render(node)
How would I achieve similar using polymer?
Thanks
<template bind="{{node}}">
<template if="{{type == 'fm'}}">
<fm-view node="{{}}"></fm-view>
</template>
<template if="{{type == 'tab'}}">
<tab-view node="{{}}"></tab-view>
</template>
<template if="{{type == 'xor'}}">
<xor-view node="{{}}"></xor-view>
</template>
<template if="{{type == 'var'}}">
<var-view node="{{}}"></var-view>
</template>
</template>
And here is another using "template ref":<template bind="{{node}}">
<template id="fm"><fm-view node="{{}}"></fm-view></template>
<template id="tab"><tab-view node="{{}}"></tab-view></template>
<template id="xor"><xor-view node="{{}}"></xor-view></template>
<template id="var"><var-view node="{{}}"></var-view></template>
<template bind ref="{{type}}"></template>
</template>