Nativescript Angular Navigation:无法找到相对于app://的模块

时间:2018-10-01 19:03:24

标签: angular nativescript nativescript-angular

成功登录后,我试图导航到新屏幕,包括选项卡导航(在新模块中),但出现以下错误: 找不到模块:“ ./ start / start.module”,相对于app://

这很可能与缺少导入有关,但是我还不能弄清楚这个问题。我已经阅读了一些有关Github的问题,但到目前为止,他们的建议使我失望了。

之前有人遇到过吗? (下面的一些代码)

您还可以研究与我要实现的in this link类似的结构。游乐场目前存在问题,但我正在调查(错误:无法匹配任何路线。URL段:“配置文件”)

谢谢

// app-routing.module.ts

(...)
const routes: Routes = [
  { path: "", redirectTo: "/login", pathMatch: "full" },
  { path: "login", component: LoginComponent },
  { path: "start", loadChildren: "./start/start.module#StartModule" }
];

// login.component.ts

login() {
  (...)
  this.router.navigate(["/start"]);
}

// start-routing.module.ts

const routes: Routes = [
  {
    path: "",
    redirectTo: "/(homeTab:home//browseTab:browse//searchTab:search)",
    pathMatch: "full"
  },

  { path: "home", component: HomeComponent, outlet: "homeTab" },
  { path: "browse", component: BrowseComponent, outlet: "browseTab" },
  { path: "search", component: SearchComponent, outlet: "searchTab" },

  { path: "item/:id", component: ItemDetailComponent, outlet: "homeTab" }
];

@NgModule({
  imports: [NativeScriptRouterModule.forRoot(routes)],
  exports: [NativeScriptRouterModule]
})
export class StartRoutingModule {}

// start.module.ts

import { StartRoutingModule } from "./start-routing.module";

@NgModule({
  imports: [
    NativeScriptModule,
    NativeScriptCommonModule,
    StartRoutingModule
  ],
  declarations: [
    BrowseComponent,
    HomeComponent,
    ItemDetailComponent,
    SearchComponent,
    StartComponent
  ],
  exports: [
    StartRoutingModule
  ],
  schemas: [NO_ERRORS_SCHEMA]
})
export class StartModule {}

1 个答案:

答案 0 :(得分:2)

有一个开放的feature request支持使用嵌套路由器插座的多种方案,希望它可以在NativeScript 5.0和Angular 6.2.0中使用