Now it's working! Thank you for your help!
The modified code:
getTemplate( templateName )
{
let templateFile = this.baseURL+'templates/'+templateName+'.html';
return new Promise(function(resolve, reject)
{
let templateRequest = Polymer.Base.importHref(templateFile,
function()
{
Polymer.dom(document.getElementById('templates')).appendChild(templateRequest.import.body);
resolve(templateRequest);
},
function(error)
{
reject(error);
});
});
};
2016. július 14., csütörtök 19:58:16 UTC+2 időpontban Karl Tiedt a
következőt írta:
>
> Sorry I wasn't very clear there, you can use either Polymer.Base.importHref
> or from an Polymer component, this.importHref I believe.
>
> -Karl Tiedt
>
> On Thu, Jul 14, 2016 at 10:52 AM, Ádám Liszkai <[email protected]
> <javascript:>> wrote:
>
>> The importHref is not only available in the custom tag? Because in the
>> program main scope the Polymer.importHref is undefined. I think you are
>> correct about the parsing, but the strange is that the console global scope
>> has the methods and the subscope has not. If I create the element and
>> append to the DOM Im also able to use it's methods but I dont want to
>> create every template a new element.
>>
>> 2016. július 14., csütörtök 19:25:14 UTC+2 időpontban Karl Tiedt a
>> következőt írta:
>>>
>>> I would suggest using Polymer's importHref method... since it handles
>>> things similarly to the link rel="import" ... I suspect you're not actually
>>> getting things parsed how you think you are with this method.
>>>
>>> -Karl Tiedt
>>>
>> 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] <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/polymer-dev/ce3caa10-50bb-4066-aeb3-bd1983abda26%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/polymer-dev/ce3caa10-50bb-4066-aeb3-bd1983abda26%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/67ff7dff-4916-4934-a098-66cdbfbd8756%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.