Encapsulate groups of entities, use templating engines, and do string interpolations in A-Frame
A template component for A-Frame VR.
|src||Selector to a
|data||Pass a component name to use the component's data as the dataset for the template context variables.|
|insert||Where to insert the rendered HTML using insertAdjacentHTML|
|type||To explicitly define the type of templating engine to use (handlebars, jade, mustache, nunjucks, html).|
Local context variables for the template are passed through the element's
data property. If both are defined, they will be combined.
|on||Event name to listen to before initializing template component.|
|data||What to set
|src||What to set
type is not defined and we are loading it from an external template, then
the component will render raw HTML.
If loading from a script tag, it must have the
type attribute defined. The
component will try to infer it from the script tag
type attribute. It will
look within the attribute string for one of
Install and use by directly including the browser files:
My A-Frame Scene
Install via NPM:
npm install aframe-template-component
Then register and use.
Note if using this within React, make sure the template is defined outside of React's root. React will treat the template as actual DOM rather than a string.