我创建了具有深子路径的路线。我将val sink: Sink[String] = Sink.foreach(x => println(x.split(",").size))
FileIO.fromPath(Paths.get("a.csv"))
.via(Framing.delimiter(ByteString("\n"), 256, true).map(_.utf8String))
.to(sink)
.run()
添加到 AdminComponent 组件中,该组件包含在NgModule中。但刷新页面后,我收到了这个错误:
<router-outlet>
也许是因为我忘了将一些模块导入 admin.module.ts
请帮忙。感谢。
app.routes.ts
'router-outlet' is not a known element
app.module.ts
export const routes: Routes = [
{
path: '',
component: AppComponent,
children: [
{
path: '',
component: LoginComponent
},
{
path: 'admin',
component: AdminComponent
},
{
path: 'user',
component: UserComponent
},
{
path: 'there',
component: ThereComponent
}
]
}
]
admin.component.ts 和 admin.module.ts
@NgModule({
imports: [
BrowserModule,
AppRoutes,
FormsModule,
ReactiveFormsModule,
HttpModule,
RouterModule,
TranslateModule.forRoot({
provide: TranslateLoader,
useFactory: (http: Http) => {
return new TranslateStaticLoader(http, './src/assets/i18n', '.json')
},
deps: [Http]
}),
UserComponentModule,
AdminComponentModule,
LoginComponentModule,
ThereComponentModule,
DashboardComponentModule
],
declarations: [
AppComponent
],
providers: [
FormBuilder
],
bootstrap: [AppComponent]
})
答案 0 :(得分:83)
AdminComponent
是AdminComponentModule
的一部分,您尚未在RouterModule
模块中导入AdminComponentModule
:
// admin.component.ts
import {Component} from "@angular/core";
@Component({
selector: 'admin',
template: "<router-outlet></router-outlet>",
})
export class AdminComponent {
constructor() {
}
}
// admin.module.ts
const ADMIN_DECLARATION = [
AdminComponent
];
@NgModule({
imports: [
BrowserModule,
TranslateModule,
RouterModule,
FormsModule,
ReactiveFormsModule
],
declarations: [
ADMIN_DECLARATION
],
exports: [
ADMIN_DECLARATION
],
providers: [
TranslateService,
FormBuilder
]
})
export class AdminComponentModule {
}
答案 1 :(得分:42)
您没有导出RouterModule。
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
答案 2 :(得分:6)
添加此代码
import { provideRoutes} from '@angular/router';
到app.module.ts
为我工作。
答案 3 :(得分:4)
在app.module.ts文件中
stanford_segmenter.py
答案 4 :(得分:0)
这对我有用:
在AppModule中添加架构[NO_ERRORS_SCHEMA]
。
import { NO_ERRORS_SCHEMA } from '@angular/core';
@NgModule({
schemas : [NO_ERRORS_SCHEMA]
})
答案 5 :(得分:0)
app.module.ts
import { MyRoutingModule } from './MyRoutingModulePath';
@NgModule({
imports: [
MyRoutingModule
])