I want to dynamically load a fragment and have the following XML-View:
<mvc:View
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:core="sap.ui.core"
xmlns:mvc="sap.ui.core.mvc"
xmlns:l="sap.ui.layout"
xmlns="sap.m"
controllerName="controller.App"
visibleBlock="true">
<App>
<pages>
...
<core:Fragment fragmentName="{= ${/BOOL_VALUE} === 'true' ? 'view.fragment1' : 'view.fragment2'}" type="XML" />
...
</pages>
</App>
</mvc:View>
but somehow, when I load it, the expression inside of fragmentName does not get evaluated and the comparison gets treated like a filename:
Uncaught (in promise) Error: resource {= ${/BOOL_VALUE} === 'true' ? 'view/fragment1' : 'view/fragment2'}.fragment.xml could not be loaded from https://sapui5.hana.ondemand.com/1.44.14/resources/{= ${/BOOL_VALUE} === 'true' ? 'view/fragment1' : 'view/fragment2'}.fragment.xml. Check for 'file not found' or parse errors. Reason: NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'https://sapui5.hana.ondemand.com/1.44.14/resources/%7B=%20$%7B/BOOL_VALUE%7…'true'%20?%20%27view/fragment1%27%20:%20%27view/fragment2%27}.fragment.xml'.
at Object.error (jquery.sap.global-dbg.js:4573)
at p (jquery-dbg.js:3187)
at Object.fireWith [as rejectWith] (jquery-dbg.js:3317)
at h3 (jquery-dbg.js:8787)
at Function.ajax (jquery-dbg.js:8689)
at Object.q.sap.loadResource (jquery.sap.global-dbg.js:4564)
at Object.X.loadTemplate (XMLTemplateProcessor-dbg.js:64)
at constructor.init (Fragment-dbg.js:469)
at constructor.F._initCompositeSupport (Fragment-dbg.js:135)
at ManagedObject-dbg.js:427
What am I doing wrong here?