3

I'm using PrimeNG and I want to display a modal dialog programmatically. I understand I should use the DialogService for this purpose. However its first argument expects a Component. This is practical when we want to create a complex dialog with dynamic content inside its body.

However I just want to display a simple text message like this

this._dialogService.open(`blah`, { header: 'some header' })

How can this be achieved with primeNG?

Antikhippe
  • 6,316
  • 2
  • 28
  • 43
Sam
  • 13,934
  • 26
  • 108
  • 194
  • What if you try `this._dialogService.open(null, { header: 'some header' })`? – Antikhippe Oct 12 '20 at 09:22
  • but I need to display some text in the body of the modal, not just a header. – Sam Oct 12 '20 at 09:36
  • If you need a body, you have to create a very basic custom component which you can reuse everywhere you need it. – Antikhippe Oct 12 '20 at 10:12
  • well, that's what I figured. But it is really overkill and I'd be surprised if there is no way to open a dialog with a simple text message. They provide this feature with dialogs that are opened from a button click for example, but I don't see how to replicate this programmatically – Sam Oct 12 '20 at 10:21

0 Answers0