0

I am using the approach that Jeremy Danyow specifies in this link:

How do you use ViewCompiler to manually compile part of the DOM?

Here is my code:

this.viewFactory.insert(this.viewportEl, '<template><' + name + '></' + name + '></template>', this);

which is working fine in the sense that it is replacing the contents of the dom element. However, the dynamic custom element is not getting compiled. I even tried adding a require statement inside the dynamic template and it gets included just fine but the custom element is still not getting compiled.

Thanks in advance.

Community
  • 1
  • 1
pQuestions123
  • 4,471
  • 6
  • 28
  • 59

1 Answers1

0

Use globalResources to ensure the custom element is loaded.

https://gist.run/?id=762c00133d5d5be624f9

Jeremy Danyow
  • 26,470
  • 12
  • 87
  • 133
  • Thanks, yes, I had thought of that. However, I was really hoping to use require instead because these elements really are page-specific and shouldn't be globalized. Is there any way to manually compile and ensure that the custom elements will be recognized? – pQuestions123 Mar 22 '16 at 11:39