Questions tagged [html-templates]

Add a template element to your document with children defining your template (including optional `slot` elements to be used with the shadow DOM) and then, as needed, copy its `content` and apply.

The HTML template element can be used for content that is not rendered by default but can be instantiated during run-time. It can have <slot> children which define a pattern for a resulting "flattened DOM tree" (when the template is added as the shadow DOM content of an element potentially with its own children). It is often used within Custom Elements and/or Shadow DOM, but this is not required.

122 questions
15
votes
5 answers

How to pass a parameter to html?

I have a script that uses the file picker but I need to pass a specific parameter which is called userId and is kept as a global variable in the calling script. As the calls are asynchronous it seems I cannot access this parameter. Is there a way to…
14
votes
2 answers

How to package, or import Html-Templates without Html-Imports

Since Html-Imports are now deprecated in Chrome (https://www.chromestatus.com/feature/5144752345317376) and will be removed, I wonder what the alternatives are. I'm currently using Html-Imports to import Html-Templates. I see only two alternatives…
treeno
  • 2,510
  • 1
  • 20
  • 36
12
votes
2 answers

Is it possible to programmatically slot elements in web components?

Is it possible to automatically or programmatically slot nested web components or elements of a specific type without having to specify the slot attribute on them? Consider some structure like this: Child…
Sebastian Zartner
  • 18,808
  • 10
  • 90
  • 132
8
votes
5 answers

Angular2 include html from server into a div

I got a serie of html in my server. For example: http://docs.example.com/intro.html http://docs.example.com/page1.html http://docs.example.com/page2.html And I trying to include those files into a
in my angular2 v4 app. For…
Sergio Mendez
  • 1,311
  • 8
  • 33
  • 56
8
votes
1 answer