我在NativeScript中创建示例应用程序。我在Android设备上运行应用程序时遇到模板解析错误。
模板中的代码只是:
<Page xmlns="http://schemas.nativescript.org/tns.xsd">
<Page.actionBar>
<ActionBar title="My ActionBar"/>
</Page.actionBar>
</Page>
我收到以下错误:
Template parse errors:
Only void and foreign elements can be self closed "ActionBar" ("<Page xmlns="http://schemas.nativescript.org/tns.xsd">
<Page.actionBar>
[ERROR ->]<ActionBar title="My ActionBar"/>
</Page.actionBar>
</Page>"): AppComponent@2:6
Error: Template parse errors:
Only void and foreign elements can be self closed "ActionBar" ("<Page xmlns="http://schemas.nativescript.org/tns.xsd">
<Page.actionBar>
[ERROR ->]<ActionBar title="My ActionBar"/>
</Page.actionBar>
</Page>"): AppComponent@2:6
at DirectiveNormalizer.normalizeLoadedTemplate (/data/data/org.nativescript.neurix/files/app/tns_modules/@angular/compiler/bundles/compiler.umd.js:13506:21)
at /data/data/org.nativescript.neurix/files/app/tns_modules/@angular/compiler/bundles/compiler.umd.js:13499:53
at ZoneDelegate.invoke (/data/data/org.nativescript.neurix/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:190:28)
at Zone.run (/data/data/org.nativescript.neurix/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:83:43)
at /data/data/org.nativescript.neurix/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:449:57
at ZoneDelegate.invokeTask (/data/data/org.nativescript.neurix/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:223:37)
at Zone.runTask (/data/data/org.nativescript.neurix/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:123:47)
at drainMicroTaskQueue (/data/data/org.nativescript.neurix/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:355:35)
当我添加结束标记时,显示另一个错误:
Error in app.component.html:0:0 caused by: this.page.frame._getNavBarVisible is not a function
TypeError: this.page.frame._getNavBarVisible is not a function
at ActionBar.update (/data/data/org.nativescript.neurix/files/app/tns_modules/ui/action-bar/action-bar.js:146:50)
at ActionBar.onLoaded (/data/data/org.nativescript.neurix/files/app/tns_modules/ui/action-bar/action-bar.js:140:14)
at eachChild (/data/data/org.nativescript.neurix/files/app/tns_modules/ui/core/view-common.js:616:23)
at Page._eachChildView (/data/data/org.nativescript.neurix/files/app/tns_modules/ui/page/page-common.js:266:9)
at Page.View._loadEachChildView (/data/data/org.nativescript.neurix/files/app/tns_modules/ui/core/view-common.js:619:18)
at Page.View.onLoaded (/data/data/org.nativescript.neurix/files/app/tns_modules/ui/core/view-common.js:609:14)
at Page.View.onLoaded (/data/data/org.nativescript.neurix/files/app/tns_modules/ui/core/view.js:82:35)
at Page.onLoaded (/data/data/org.nativescript.neurix/files/app/tns_modules/ui/page/page-common.js:45:35)
at Page.View._addViewCore (/data/data/org.nativescript.neurix/files/app/tns_modules/ui/core/view-common.js:962:18)
at Page.View._addViewCore (/data/data/org.nativescript.neurix/files/app/tns_modules/ui/core/view.js:127:39)
答案 0 :(得分:5)
<ActionBar title="My ActionBar"></ActionBar>
- 你无法使用自闭标签。