我想用Angular 2.0.1
,NativeScript 2.3.0
实现一个TabView . 我按照这个官方指南here,但遇到下面的问题 .
<TabView #tabview>
[ERROR ->]<StackLayout *tabItem="{title: 'Profile'}" >
<ListView [items]='items'>
<template let-i"): LoginComponent@17:4
Property binding tabItem not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "directives" section. ("
</ListView>
</StackLayout>
[ERROR ->]<StackLayout *tabItem="{title: 'Stats'}">
<Label text="Second tab item"></Label>
</StackLay"): LoginComponent@24:4
Property binding tabItem not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "directives" section. ("
<Label text="Second tab item"></Label>
</StackLayout>
[ERROR ->]<StackLayout *tabItem="{title: 'Settings'}">
<Label text="Third tab item"></Label>
我从编译器得到的错误是
Property binding tabItem not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "directives" section.
我认为 nativescript directives 默认都包括在内,例如: Button
, TextField
等 . 是 *tabItem
我需要手动导入的特殊指令吗?
顺便说一下,我真正想要做的是在手机底部有一个TabView棒,就像带有几个标签的Dock一样,就像Facebook移动应用程序底座一样 . 有人可以发布代码片段吗?
2 回答
确保在Angular
@NgModule
中导入NativeScriptModule
:答案很晚但希望能帮助别人 .
这个问题是在2年前被问到的,但我今天遇到了这个错误,这就是我最终修复它的方法 . 我使用一个结构,其中所有页面都由
PageModule
导入,PageModule
然后由AppModule
导入 . 手头的问题:PageModule
不知道NativeScriptModule
. 如果将NativeScriptModule
添加到PageModule
(或其他任何模块)的import
数组中,则_2483113将解决问题 .