With below XML view code as an example, I will elaborate about the metadata configuration.
<core:View xmlns:core="sap.ui.core" xmlns="sap.m" controllerName="Demo.view.Main" displayBlock="true" height="100%">
<App id="app">
</App>
</core:View>
App
control is the root element for UI5 mobile application. It has pages
aggregation as it extends from NavContainer
.
targetControl: "app",
targetAggregation: "pages"
targetControl
is specified with ID of control which is used to display the pages. In above XML, App
control has "app" as it's ID.
So, all your views will be placed in pages
aggregation of App
control.
Now, you might be wondering how views can be placed in pages
aggregation.
If you look at type of controls allowed in pages
aggregation is Control
. Any control which extends Control
class can be placed in pages
of App
. As View
is also Control it is valid to be added in pages
aggregation.
So, all views in application are placed in App
.
"targetParent": "myViewId"
targetParent
is nothing but the view in which App
control is placed.
Regarding difference between above and this
"controlId": "app",
"controlAggregation": "pages"
In newer version of SAPUI5, we specify configuration in manifest.json file instead of Component.js file. So, you will find this configuration their.
They are one and same but only with different names.