Compiling Declarative HTML

OpenUI5 provides a plugin for controls that are defined as declarative markup on startup time.

To compile the declarative UI markup deferred, for example, when the markup is dynamically loaded and added to the DOM you can call the sap.ui.core.plugin.DeclarativeSupport.compile method, see the following code snippet:

#!html
<div id="button">
  <div data-sap-ui-type="sap.ui.commons.Button" data-text="This button is added dynamically"></div>
</div>

<script>
  sap.ui.core.plugin.DeclarativeSupport.compile(document.getElementById("button"));
</script>