tag tab page change attribute angular typescript angular-routing

tab - set title angular 4



Dependencia circular angular 4 detectada (1)

Actualizando Angular Cli a 1.3.1 Tengo algunas advertencias ahora

WARNING in Circular dependency detected: src/app/work-sessions/work-session-list/work-session-list.routing.ts -> src/app/work-sessions/work-session-list/index.ts -> src/app/work -sessions/work-session-list/work-session-list.routing.ts

Cada clase tiene una estructura como esta:

work-session-list.routing.ts

import { Route } from ''@angular/router''; import { WorkSessionListComponent } from ''./index''; export const WorkSessionRoutes: Route[] = [ { path: '''', component: WorkSessionListComponent }, ];

Index.ts

export * from ''./work-session-list.component''; export * from ''./work-session-list.routing'';

work-session-list.module.ts

import { WorkSessionListComponent } from ''./work-session-list.component''; import { WorkSessionRoutes } from ''./work-session-list.routing''; import { DataTableModule } from ''primeng/primeng''; import { CommonModule } from ''@angular/common''; import { NgModule } from ''@angular/core''; import { FormsModule } from ''@angular/forms''; import { RouterModule } from ''@angular/router''; @NgModule( { imports: [RouterModule.forChild( WorkSessionRoutes ), CommonModule , FormsModule], declarations: [WorkSessionListComponent], exports: [WorkSessionListComponent] } ) export class WorkSessionListModule { }

Que en app.routing.ts

export const AppRoutes: Routes = [ { path: ''workSession'', loadChildren: ''./work-sessions/work-session-list/work-session-list.module#WorkSessionListModule'' } . . .

Y en app.module

@NgModule({ imports: [ CommonModule, BrowserAnimationsModule, FormsModule, RouterModule.forRoot(AppRoutes), }) ], declarations: [ AppComponent ] bootstrap: [AppComponent] }) export class AppModule {}

¿Como puedo resolver esto? Funciona pero tengo muchas advertencias.


Como dice la advertencia, work-session-list.routing.ts depende de index.ts :

import { WorkSessionListComponent } from ''./index'';

Y index.ts depende de work-session-list.routing.ts :

export * from ''./work-session-list.routing'';

La primera dependencia no es necesaria, ya que podría importar WorkSessionListComponent directamente desde su archivo fuente:

import { WorkSessionListComponent } from ''./work-session-list.component'';

Este cambio debería solucionar el problema.