To create and then add a component instance dynamically you should take 2 following things into account:
- You should add the dependency of the desired component to the
rootDependencies
- Create the component using the document API method
createElement()
- Append the component to the Cubbles container (by default the
body
otherwise the element having thecubx-core-crc
attribute)
These The code below presents this process for adding a new cubx-textarea
to an existing app:
...
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/22156475. Please note that if want to initialize the component you should do it before it is appended to the DOM2.4 | The Cubbles Tag API and the 2.4 | The Cubbles Javascript API.
Note | ||
---|---|---|
| ||
Although you may want to append the component using the |
...