我希望在 TabView 标记中包含子视图

这是我的 TabView 的代码

<StackLayout *tabItem="{title: 'Home'}" >
   <Label text="This is Label in Tab 1"></Label>
    <router-outlet></router-outlet> 
 </StackLayout>
 <StackLayout *tabItem="{title: 'History'}">
   <Label text="This is Label in Tab 2"></Label>
 </StackLayout>
 <StackLayout *tabItem="{title: 'Feedback'}">
   <Label text="This is Label in Tab 3"></Label>
 </StackLayout>
</TabView>

如您所见,我在第一个视图中有 <router-outlet></router-outlet> 标记,这是我要加载子视图的位置 .

这是路线的代码

export const routes = [
    { path: '', component: tabviewCompoenent, children: [
      { path: '', redirectTo: 'childComponenet', pathMatch: 'full' },
      { path: 'childComponenet', component: childComponenet}
     ]
    }
];

执行以上操作在控制台中提供以下内容

在设备169.254.138.177:5555上成功同步了应用程序org.nativescript.AngularStarter . JS:Angular 2正在开发模式下运行 . 调用enableProdMode()以启用 生产环境 模式 . JS:Selected选项卡索引:0 JS:EXCEPTION:页面/ other / other.component.html:19:13中的错误:表达式在检查后发生了变化 . 上一个值:'false' . 当前值:'true' . JS:ORIGINAL EXCEPTION:表达式在检查后发生了变化 . 上一个值:'false' . 当前值:'true' . JS:ORIGINAL STACKTRACE:JS:错误:表达式在检查后发生了变化 . 上一个值:'false' . 当前值:'true' . JS:在ExpressionChangedAfterItHasBeenCheckedError.Error(天然)JS:在ExpressionChangedAfterItHasBeenCheckedError.BaseError [作为构造](/data/data/org.nativescript.AngularStarter/files/app/tns_modules/@angular/core/bundles/core.umd.js: 1104:38)JS:在新ExpressionChangedAfterItHasBeenCheckedError(/data/data/org.nativescript.AngularStarter/files/app/tns_modules/@angular/core/bundles/core.umd.js:5092:20)JS:在checkBinding(/ data/data/org.nativescript.AngularStarter/files/app/tns_modules/@angular/core/bundles/core.umd.js:5236:23)JS:在Wrapper_NgIf.check_ngIf(/CommonModule/NgIf/wrapper.ngfactory.js :12:23)JS:在DebugAppView._View_tabviewCompoenent0.detectChangesInternal(/AppModule/tabviewCompoenent/component.ngfactory.js:202:19)JS:在DebugAppView.AppView.detectChanges(/data/data/org.nativescript.AngularStarter/files /app/tns_modules/@angular/core/bundles/core.umd.js:9305:18)JS:在DebugAppView.detectChanges(/data/data/org.nativescript.AngularStarter/files/app/tns_modu) les/@angular/core/bundles/core.umd.js:9410:48)JS:在DebugAppView.AppView.detectViewChildrenChanges(/data/data/org.nativescript.AngularStarter/files/app/tns_modules/@angular/core/ bundles / core.umd.js:9331:23)JS:在DebugAppView._View_tabviewCompoenent_Host0.detectChangesInternal(/AppModule/tabviewCompoenent/host.ngfactory.js:33:8)JS:ERROR CONTEXT:JS:[object Object] JS:Error :页面/ other / other.component.html:19:13中的错误:表达式在检查后发生了变化 . 上一个值:'false' . 当前值:'true' .