Nativescript:错误:在列表模板中找到多个视图!嵌套级别:0

Nativescript:错误:在列表模板中找到多个视图!嵌套级别:0,nativescript,angular2-nativescript,Nativescript,Angular2 Nativescript,list.html <ActionBar title="View Team Members"> <NavigationButton text="Back" android.systemIcon="ic_menu_back"></NavigationButton> </ActionBar> <GridLayout> <ListView [items]="teamList" class="small-spacing"&

list.html

<ActionBar title="View Team Members">
    <NavigationButton text="Back" android.systemIcon="ic_menu_back"></NavigationButton>
</ActionBar>
<GridLayout>
    <ListView [items]="teamList" class="small-spacing">
        <template let-item="item">
            <StackLayout>
              <Label [text]="item.name" class="medium-spacing"></Label>
              <Label [text]="item.email" class="medium-spacing"></Label>
            </StackLayout>
        </template>
    </ListView>
</GridLayout>
行:138,列:8

StackTrace: 
  Frame: function:'getSingleViewRecursive', file:'/data/data/org.nativescript.finlyng/files/app/tns_modules/nativescript-angular/directives/list-view-comp.js',
行:138,列:15 框架:函数:'getSingleViewFromViewRef',文件:'/data/data/org.nativescript.finlyng/files/app/tns_modules/nativescript angular/directives/list view comp.js', 行:154,列:12 框架:函数:'ListViewComponent.onItemLoading',文件:'/data/data/org.nativescript.finlyng/files/app/tns_modules/nativescript angular/directives/list view comp.js', 行:72,列:25 框架:函数:'Observable.notify',文件:'/data/data/org.nativescript.finlyng/files/app/tns_modules/data/Observable/Observable.js', 第146行第32列 框架:函数:'ListViewAdap


这是相当古老的,但我有一个类似的问题

我通过在GridLayout中嵌套标签来修复它。在我的例子中是这样的:

<GridLayout rows="auto, *">
  <ListView [items]="newsList" row="1" class="news">
    <ng-template let-item="item">
      <GridLayout rows="auto, *">
        <Image [src]="item.image"></Image>
        <Label [text]="item.title" class="news__item"></Label>
      </GridLayout>
    </ng-template>
  </ListView>
</GridLayout>


确保已保存文件(包装在堆栈布局中时),然后重新生成应用程序。事实上,您的项目模板只能有一个根元素,并且错误不应该出现在现有结构中-这里的基本示例:@NickIliev saved and rebuilded,错误仍然存在。
<GridLayout rows="auto, *">
  <ListView [items]="newsList" row="1" class="news">
    <ng-template let-item="item">
      <GridLayout rows="auto, *">
        <Image [src]="item.image"></Image>
        <Label [text]="item.title" class="news__item"></Label>
      </GridLayout>
    </ng-template>
  </ListView>
</GridLayout>