Every Polymer element has this (prototypical) method:

    fetchTemplate: function(elementElement) {
      return elementElement.querySelector('template');
    }


You can override this method to return whatever template you want, just
keep in mind that it may get called more than once if your element has
other Polymer superclasses.



On Thu, May 15, 2014 at 1:38 PM, <[email protected]> wrote:

> I'll give that a try and see if works and how it feels. I was hoping that
> that I could place a "function" into the ref, or add an "element" to the
> page that sets a strategy handler somewhere and have that handler run to
> perform the selection e.g. search the dom. That way the logic is not
> scattered around on the templates themselves.
>
>
>
> On Thursday, May 15, 2014 2:20:36 PM UTC-4, Eric Bidelman wrote:
>
>> Can you just use conditional 
>> templates<http://www.polymer-project.org/docs/polymer/binding-types.html#conditional-templates>for
>>  this?
>>
>> <template if="{{jsonObj.type == 'foo'}}">
>>   ...
>> </template>
>>
>> <template if="{{jsonObj.type == 'bar'}}">
>>   ...
>> </template>
>>
>>
>> On Thu, May 15, 2014 at 7:00 AM, <[email protected]> wrote:
>>
>>> Is there any way to set a template selection "ref" that can be chained
>>> to the default algorithm which selects by ref name?
>>>
>>> I typically bind to json data and wanted to have a template
>>> automatically selected based on a "type" field in my json object.
>>>
>>> I do not mind loading 10-15, relatively small templates up front for the
>>> different types of visual presentations for specific data objects in my
>>> webapp.
>>>
>>>  Follow Polymer on Google+: plus.google.com/107187849809354688692
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Polymer" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>>
>>> To view this discussion on the web visit https://groups.google.com/d/
>>> msgid/polymer-dev/906b1429-ca0e-48cc-8d6e-602c1b7d1e8b%
>>> 40googlegroups.com<https://groups.google.com/d/msgid/polymer-dev/906b1429-ca0e-48cc-8d6e-602c1b7d1e8b%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  Follow Polymer on Google+: plus.google.com/107187849809354688692
> ---
> You received this message because you are subscribed to the Google Groups
> "Polymer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/polymer-dev/b7caf7fb-7938-414f-b05d-7c66e894e4f2%40googlegroups.com<https://groups.google.com/d/msgid/polymer-dev/b7caf7fb-7938-414f-b05d-7c66e894e4f2%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

Follow Polymer on Google+: plus.google.com/107187849809354688692
--- 
You received this message because you are subscribed to the Google Groups 
"Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/polymer-dev/CAHbmOLa4DyzzoXwZ55MZjYBsVexSNg9ep%3Dit8cs3x%2BFp3oaKKg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to