I am new on using PrimeNG and I need a confirmation dialog box. I read the documentation about confirmation dialog and implemented it on my component.
my-component.ts
import { ConfirmDialogModule, ConfirmationService } from 'primeng/primeng';
my-component.html
<p-confirmDialog header="Order Confirmation" icon="fa fa-question-circle" width="425" #cd>
<p-footer>
<button type="button" pButton icon="fa-close" label="No" (click)="cd.reject()"></button>
<button type="button" pButton icon="fa-check" label="Yes" (click)="cd.accept()"></button>
</p-footer>
</p-confirmDialog>
app.module.ts
import { ConfirmDialogModule, ConfirmationService } from 'primeng/primeng';
@NgModule({
declarations: [
],
imports: [
BrowserModule,
ConfirmDialogModule,
FormsModule,
ReactiveFormsModule,
HttpModule,
AppRoutingModule
],
providers: [ConfirmationService],
bootstrap: [AppComponent]
})
export class AppModule { }
Anything that I missed that triggers the error? Please enlighten me.
Got it! I just need to import SharedModule in order to use it.
import { ConfirmDialogModule, ConfirmationService, SharedModule } from 'primeng/primeng';
then include it in @NgModule
@NgModule({
declarations: [
],
imports: [
ConfirmDialogModule,
SharedModule
],
providers: [ConfirmationService],
bootstrap: [AppComponent]
})
Because of header and footer are reserved PrimeNG changed those to p-header and p-footer and yes, they are inside of the SharedModule.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With