我正在尝试测试OpenUI5 1.30.x
的{{3}}。
然而,命名空间似乎搞砸了。
我的观点,
<mvc:View
controllerName="local.controller"
xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m"
xmlns:template="http://schemas.sap.com/sapui5/extension/sap.ui.core.template/1">
<List
items="{/Categories}">
<StandardListItem title="{Name}" info="{ID}" />
</List>
<Label text="Categories with ID > 0:" />
<template:repeat list="{/Categories}" var="cat">
<template:if test="{= ${cat>ID} > 0 }">
<Label text="{cat>Name}" />
<Text text="{cat>ID}" />
</template:if>
</template:repeat>
</mvc:View>
我在控制台中看到的错误:
Uncaught Error: failed to load 'http://schemas/sap/com/sapui5/extension/sap/ui/core/template/1/repeat.js'
from https://openui5.hana.ondemand.com/1.30.7/resources/http://schemas/sap/com/sapui5/extension/sap/ui/core/template/1/repeat.js
: 404 - Not Found
我的UI5引导程序脚本如下所示:
<script id="sap-ui-bootstrap"
src="https://openui5.hana.ondemand.com/1.30.7/resources/sap-ui-core.js"
data-sap-ui-theme="sap_bluecrystal"
data-sap-ui-libs="sap.m"
data-sap-ui-bindingSyntax="complex">
</script>
以上所有例子都可以在这个jsbin中看到:new XML template preprocessing features
我假设有一个图书馆注册,我需要这样做,我不这样做?否则UI5不会尝试在库的路径下加载模板架构。
答案 0 :(得分:0)
From the "XML Templating in OpenUI5" documentation, it appears that you must pass the preprocessor info into the view upon view instantiation:
var oTemplateView = sap.ui.view({
preprocessors: {
xml: {
bindingContexts: {
meta: oMetaModel.getMetaContext(sPath)
},
models: {
meta: oMetaModel
}
}
},
type: sap.ui.core.mvc.ViewType.XML,
viewName: "sap.ui.core.sample.ViewTemplate.tiny.Template"
});