Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

To create and then add a component instance dynamically you should take 2 following things into account:

  1. You should add the dependency of the desired component to the rootDependencies
  2. Create the component using the document API method createElement()
  3. Append the component to the Cubbles container (by default the body otherwise the element having the cubx-core-crc attribute)

...

You may also be interested in defining inits and connections for the component before appending it to the dom. Then, you should checkt the /wiki/spaces/RTE/pages/22156188 and the /wiki/spaces/RTE/pages/221564752.4 | The Cubbles Tag API and the 2.4 | The Cubbles Javascript API.

Note
titleUse document.createElement

Although you may want to append the component using the innerHTML property of a container, we recommend you to use the document.createElement()method, so that everything works properly.

...