组件CommentListComponent不是任何NgModule的一部分,或者该模块尚未导入到您的模块中

时间:2019-10-15 12:26:31

标签: javascript angular typescript

当我需要进入CommentListComment时,它向我显示此错误:

  

组件CommentListComponent不属于任何NgModule或模块尚未导入到模块中。

这是我的代码:

  @NgModule({
  declarations: [CommentListComponent, CourseCommentComponent, CommentAddComponent, CommentEditComponent, CommentFiltersComponent, CommentReplyComponent],
  imports: [
    CommonModule,

    // routing module imported here
    LessonCommentRoutingModule,

    CommonModule,
    CoreModule,
    ReactiveFormsModule,
    FormsModule,
    PartialsModule,
    TranslateModule.forChild(),
    Angular2PromiseButtonModule.forRoot(promiseButtonConfig),
    SharedModule
  ],
  exports:[CommentListComponent, CourseCommentComponent, CommentAddComponent, CommentEditComponent, CommentFiltersComponent, CommentReplyComponent]
})

这是我的LessonCommentRoutingModule:

{
    path: '', component: CommentListComponent
    , data: {
        permission: {
            permittedRoles: [':CourseLessonComment:GetAllManager'],
            deniedRoles: null
        } as AuthGuardPermission,
        breadcrumb: 'Course Comments'
    }
},
{
    path: 'list',
    component: CommentListComponent,
    data: {
        permission: {
            permittedRoles: [':CourseLessonComment:GetAllManager'],
            deniedRoles: null
        } as AuthGuardPermission,
        breadcrumb: 'List',
    },
    canActivate: [AuthGuard]
},
{
    path: 'list/:lessonId',
    component: CommentListComponent,
    data: {
        permission: {
            permittedRoles: [':CourseLessonComment:GetAllManager'],
            deniedRoles: null
        } as AuthGuardPermission,
        breadcrumb: 'List',
    },
    canActivate: [AuthGuard]
},

出了什么问题?我该如何解决????

编辑:

@Component({
    selector: 'kt-comment-list',
    templateUrl: './comment-list.component.html',
    styleUrls: ['./comment-list.component.scss']
})
export class CommentListComponent implements OnInit, OnDestroy, AfterViewInit {

    @ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
    dataSource: CommentDataSource;
.............

0 个答案:

没有答案