I'm trying to apply lazy loading in my application, but for some reason I'm not finding the component import I make in my component's routing file, returning:
Uncaught Error: Component CustofixesComponent is not part of any NgModule or the module has not been imported into your module.
costfile.module.ts:
import { DialogConfirmacaoExclusaoModule } from './../../dialogexclusao/dialog-confirmacao-exclusao.module';
//Importação de módulos angular
import { MyMaterialDesignModule } from '../../../app.materialdesign.module';
import { MatMenuModule } from '@angular/material/menu';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { HttpClientModule } from '@angular/common/http';
import { NgxCurrencyModule } from "ngx-currency";
import { ReactiveFormsModule } from '@angular/forms';
import { LoadingModule } from '../../loading/loading.module';
import { NgxMaskModule } from 'ngx-mask'
import { MostraToastService } from '../../../services/mostratoast.service';
import { CustoFixoRoutingModule } from './custofixo.routing.module';
//Importação de componentes do módulo
import { CustofixoComponent } from './custofixo.component';
import { MatTooltipModule } from '@angular/material';
import { CustosService } from '../../../services/custos.service';
import { DialogConfirmacaoExclusao } from '../../dialogexclusao/dialog-exclusao.component';
import { AuthService } from '../../../services/auth.service';
import { svgInfoManModule } from '../../svgInfoMan/svgInfoMan.module';
@NgModule({
imports: [
CustoFixoRoutingModule,
CommonModule,
FormsModule,
LoadingModule,
MyMaterialDesignModule,
HttpClientModule,
MatMenuModule,
MatTooltipModule,
ReactiveFormsModule,
DialogConfirmacaoExclusaoModule,
NgxCurrencyModule,
NgxMaskModule,
svgInfoManModule,
],
exports:[
CustofixoComponent
],
declarations: [CustofixoComponent],
entryComponents:[DialogConfirmacaoExclusao],
providers:[
CustosService,
MostraToastService,
AuthService
]
})
export class CustoFixoModule { }
costfixo.routing.ts: This is where the error is generated, for some reason it does not recognize the import of the ComponentCustoFix component. Am I forgetting something?
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { CustofixoComponent } from './custofixo.component';
const custoFixoRoutes: Routes = [
{
path: '', component: CustofixoComponent
}
];
@NgModule({
imports: [RouterModule.forChild(custoFixoRoutes)],
exports: [RouterModule]
})
export class CustoFixoRoutingModule {}
My root module routing:
const dashboardRoutes: Routes = [
{path: 'dash', component: DashboardComponent, canActivate: [AuthGuard],
children: [
{ path: '', loadChildren: 'src/app/components/dashboard/bemvindo/bemvindo.module#BemVindoModule' },
{ path: 'home', loadChildren: 'src/app/components/dashboard/bemvindo/bemvindo.module#BemVindoModule' },
{ path: 'custofixo', loadChildren: 'src/app/components/dashboard/custofixo/custofixo.module#CustoFixoModule' }
The welcome module works correctly, but I have already compared the two codes and they have no differences with respect to the modules / routing