NativeScript:获取模板解析错误:只有 void 和 foreign 元素可以自关闭
NativeScript : Getting Template parse errors: Only void and foreign elements can be self closed
我正在使用 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)
<ActionBar title="My ActionBar"></ActionBar>
- 你不能使用自闭标签。
我正在使用 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)
<ActionBar title="My ActionBar"></ActionBar>
- 你不能使用自闭标签。