Nativescript角路线导航不起作用

时间:2020-04-01 09:52:02

标签: angular routing nativescript angular2-nativescript nativescript-angular

我正在遵循有关横向导航的Nativescript指南here。我可以从父组件导航到ChildA和ChildB,但是当从ChildB导航到ChildB-A时,它无法导航并且没有任何响应。

我不确定此实现是否适用于子导航,请对此提供建议。

导航结构:

Parent
  -> ChildA (Working)
  -> ChildB (Working)
     -> ChildB-A (Not Working)

Parent.module.ts:

NativeScriptRouterModule.forChild([
 { path: "", redirectTo: "parent", pathMatch: "full" },
 { path: "parent", component: ParentComponent, },
 { path: "childA", component: ChildAComponent },
 { path: "childB", component: ChildBComponent },
 { path: "chihildBA",component: ChildBAComponent } 
])

Parent.component.ts:

goToChildA() {
  this.routerExtensions.navigate(['../childA'], { relativeTo: this.activatedRoute }); //Working
}

goToChildB() {
  this.routerExtensions.navigate(['../childB'], { relativeTo: this.activatedRoute }); //Working
}

ChildB.component.ts(点击并执行goToChildBA时,什么也没有发生)

goToChildBA() {
  this.routerExtensions.navigate(['../childBA'], {relativeTo: this.activatedRoute}); //Not Working
}

0 个答案:

没有答案