找不到TasklistItemsFormComponent的组件工厂。你有没有把它添加到@ NgModule.entryComponents

时间:2018-04-20 12:05:16

标签: angular angular5

我收到错误No component factory found for TasklistItemsFormComponent. Did you add it to @NgModule.entryComponents我已将组件添加到我的延迟加载模块的entryComponents部分。

这是我的app.routing:

export const routes: Routes = [
  {
    path: '',
    redirectTo: '/dashboard',
    pathMatch: 'full',
  },
  {
    path: '',
    component: FullLayoutComponent,
    data: {
      title: 'Início'
    },
    children: [
      {
        path: 'dashboard',
        loadChildren: './dashboard/dashboard.module#DashboardModule',
        canActivate: [AdminGuard]
      },
      {
        path: 'tasklists',
        loadChildren: './tasklists/tasklists.module#TasklistsModule',
        canActivate: [AdminGuard]
      }
    ]
  }

];

@NgModule({
  imports: [ RouterModule.forRoot(routes) ],
  exports: [ RouterModule ],
  providers: [
    AdminGuard,
    AuthService
  ]
})
export class AppRoutingModule {}

TasklistModule:

import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { HttpModule } from '@angular/http';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';

import { BsDatepickerModule } from 'ngx-bootstrap/datepicker';
import { NgSelectModule } from '@ng-select/ng-select';
import { PaginationModule } from 'ngx-bootstrap/pagination';

import { TasklistsRoutingModule } from './tasklists-routing.module';
import { TasklistsSearchComponent } from './tasklists-search/tasklists-search.component';
import { TasklistsFormComponent } from './tasklists-form/tasklists-form.component';


import { MomentModule } from 'angular2-moment';

import { DateFormatPipe } from '../shared/pipes/date-format.pipe';
import { TasklistResourcesComponent } from './tasklist-resources/tasklist-resources.component';
import { TasklistItemsComponent } from './tasklist-items/tasklist-items.component';
import { TasklistResourcesFormComponent } from './tasklist-resources/tasklist-resources-form/tasklist-resources-form.component';
import { TasklistItemsFormComponent } from './tasklist-items/tasklist-items-form/tasklist-items-form.component';
import { TasklistItemsGridComponent } from './tasklist-items/tasklist-items-grid/tasklist-items-grid.component';
import { TasklistResourcesGridComponent } from './tasklist-resources/tasklist-resources-grid/tasklist-resources-grid.component';
import { TasklistSubformHeaderComponent } from './tasklist-subform-header/tasklist-subform-header.component';
import { SharedModule } from 'app/shared.module';

@NgModule({
  imports: [
    CommonModule,
    HttpModule,
    PaginationModule.forRoot(),
    NgSelectModule,
    FormsModule,
    ReactiveFormsModule,
    TasklistsRoutingModule,
    BsDatepickerModule,
    MomentModule,
    SharedModule
  ],
  declarations: [
    TasklistsSearchComponent,
    TasklistsFormComponent,
    DateFormatPipe,
    TasklistResourcesComponent,
    TasklistItemsComponent,
    TasklistResourcesFormComponent,
    TasklistItemsFormComponent,
    TasklistItemsGridComponent,
    TasklistResourcesGridComponent,
    TasklistSubformHeaderComponent
  ],
  entryComponents: [
    TasklistItemsFormComponent,
    TasklistItemsGridComponent]
})
export class TasklistsModule { }

我还有AppModule和SharedModule(我不时将一些声明从AppModule移到SharedModule)。

0 个答案:

没有答案