When you want to insert one component into another component, you will need to utilize the ComponentContainer
. This can be done by providing a URL and other properties if your application is unaware of the child component upfront. For instance, if your main app receives information about the child component from a data service during runtime.
For more information, visit:
The ComponentContainer
can be used similarly to other controls – it can be included in XML views or instantiated within the controller and then added to the content of the page, for example.
Important Note: Ensure that the URL of the child component is from the same host. If it is from a different host, make sure it allows retrieval through ajax requests (cross-origin policy adherence).
Update 2021-01-04: Here is a simple demonstration on JS Fiddle:
View the example here: https://jsfiddle.net/iPirat/t30sr8zw/
In this demo, I have embedded the Button-Sample-Component from sapui5.hana.ondemand.com
. However, due to CORS policy restrictions, it will only function if you disable web security in your browser. See an example on how to do so in Chrome here.
https://i.sstatic.net/lfllQ.png