Angular java.lang.IllegalArgumentException:无法将空子视图添加到ViewGroup Nativescript

Angular java.lang.IllegalArgumentException:无法将空子视图添加到ViewGroup Nativescript,angular,nativescript,Angular,Nativescript,我添加到我的NativeScript Angular项目中。我的app.component.html如下所示: <RadSideDrawer> <GridLayout tkDrawerContent rows="auto, *" class="sidedrawer sidedrawer-left"> <StackLayout row="0" style="margin-bottom: 30px;"> <StackLay

我添加到我的NativeScript Angular项目中。我的app.component.html如下所示:

<RadSideDrawer>
   <GridLayout tkDrawerContent rows="auto, *" class="sidedrawer sidedrawer-left">
      <StackLayout row="0" style="margin-bottom: 30px;">
         <StackLayout orientation="horizontal" style="padding: 13px 20px;">
            <label text="Hasan Tekin" textWrap="false" style="font-size: 20px;color: white;margin: 20 30 10 10;"></label>
         </StackLayout>
      </StackLayout>
      <ScrollView row="1">
         <StackLayout class="sidedrawer-content">
            <StackLayout *ngFor="let item of state.sideDrawer.items; let i = index">
               <StackLayout orientation="horizontal" style="padding: 13px 0;" (tap)="activateMenuItem(i)" [routerLink]="['/mysurveys']">
                  <Image [src]="item.active ? '~/assets/images/arrowGreen.png' : '~/assets/images/arrowGray.png'" style="width: 40px;margin: 0 20px;"></Image>
                  <label text={{item.text}} textWrap="false" [class]="item.active ? 'menuItemActive' : 'menuItem'"></label>
               </StackLayout>
               <StackLayout class="hr-dark m-10">
               </StackLayout>
            </StackLayout>
         </StackLayout>
      </ScrollView>
   </GridLayout>

   <page-router-outlet tkMainContent class="page page-content"></page-router-outlet>
</RadSideDrawer>

原因是什么?

完全是我的错。我在
app.module.ts
中导入了侧抽屉,而不是
app.module.tns.ts
。现在,我删除了该导入并将其写入
app.module.tns.ts
中,它可以正常工作。

您是否有一个可以复制该问题的游乐场?作为补充,请避免过度嵌套(为什么需要网格>堆栈>堆栈>标签-这只是为了显示单个标签而创建了一个沉重的布局系统)。另一个注意事项-使用DP代替PX作为测量单位。第一个将在不同的跳水中进行相同的缩放,而第二个将不同,
Error: java.lang.IllegalArgumentException: Cannot add a null child view to a ViewGroup