import { CommonModule } from '@angular/common'; import { ModuleWithProviders, NgModule } from '@angular/core'; import { ReactiveFormsModule } from '@angular/forms'; import { ButtonModule } from 'primeng/button'; import { CardModule } from 'primeng/card'; import { InputTextModule } from 'primeng/inputtext'; import { InputTextareaModule } from 'primeng/inputtextarea'; import { CommentFormComponent } from './components/comment-form/comment-form.component'; import { CommentComponent } from './components/comment/comment.component'; import { CommentsComponent } from './components/comments/comments.component'; import { CommentService, commentTypeToken } from './services/comment.service'; @NgModule({ declarations: [CommentsComponent, CommentComponent, CommentFormComponent], imports: [ CommonModule, CardModule, InputTextModule, ButtonModule, InputTextareaModule, ReactiveFormsModule, ], exports: [CommentsComponent], providers: [CommentService], }) export class CommentModule { static forRoot( commentType: 'solution' | 'issues' ): ModuleWithProviders { return { ngModule: CommentModule, providers: [{ provide: commentTypeToken, useValue: commentType }], }; } }