Nativescript Angular 导航:找不到与 app:// 相关的模块
Nativescript Angular Navigation: Failed to find module relative to app://
成功登录后,我尝试导航到包括选项卡导航(在新模块中)的新屏幕,但出现以下错误:
找不到模块:“./start/start.module”,相对于 app://
这很可能与缺少导入有关,但我还没有找出问题所在。我已经通读了一些 Github 个问题,但到目前为止他们的建议让我失望了。
有没有其他人遇到过这种情况? (下面的一些代码)
您还可以查看与我正在尝试实现的非常相似的结构 in this link。操场上目前有一个问题,但我正在调查它(错误:无法匹配任何路线。URL 段:'profile')
谢谢
//应用-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"]);
}
//开始-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 {}
有一个开放的feature request支持使用嵌套路由器出口的多种场景,希望它能与NativeScript 5.0 & Angular 6.2.0
一起准备好
成功登录后,我尝试导航到包括选项卡导航(在新模块中)的新屏幕,但出现以下错误: 找不到模块:“./start/start.module”,相对于 app://
这很可能与缺少导入有关,但我还没有找出问题所在。我已经通读了一些 Github 个问题,但到目前为止他们的建议让我失望了。
有没有其他人遇到过这种情况? (下面的一些代码)
您还可以查看与我正在尝试实现的非常相似的结构 in this link。操场上目前有一个问题,但我正在调查它(错误:无法匹配任何路线。URL 段:'profile')
谢谢
//应用-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"]);
}
//开始-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 {}
有一个开放的feature request支持使用嵌套路由器出口的多种场景,希望它能与NativeScript 5.0 & Angular 6.2.0
一起准备好