Primeng: p-messages doesn't show static content

Created on 13 Jul 2020  路  5Comments  路  Source: primefaces/primeng

I'm submitting a ... (check one with "x")

[x] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Plunkr Case (Bug Reports)
Case available on documentation stackblitz
https://stackblitz.com/edit/primeng-messages-demo

Meesages static content

Current behavior
Static template for p-massages doesn't work. I tried pTemplate="content" or just pTemplate and in both cases it doesn't show static messages with custom content. Moreover, when you click on 'User Service' button in stackblitz it will add the message in 2 places - where we plan to show message via service and to empty message where I want to have custom static content.

Expected behavior
Static template works correct.

  • Angular version: 9.1.3

  • PrimeNG version: 9.1.3

  • Browser: ALL

Most helpful comment

I figured out, that it works if I add ToastModule to AppModule. However, it's not clear why there is a dependency on ToastModule, I didn't find any docs which said that we have to include ToastModule to have MessagesModule work correct.
By the way, there is the same behavior with OverlayPanelModule, if I don't import ToastModule, it will not work

All 5 comments

I figured out, that it works if I add ToastModule to AppModule. However, it's not clear why there is a dependency on ToastModule, I didn't find any docs which said that we have to include ToastModule to have MessagesModule work correct.
By the way, there is the same behavior with OverlayPanelModule, if I don't import ToastModule, it will not work

Unable to replicate with PrimeNG 10.0.0-rc.3, if the issue persists please create a new ticket with a test case reproducing the issue e.g. stackblitz or a github repo and it will be reviewed by our team once again.

Exactly same as @fenixrom in "primeng": "^10.0.3", needed to import ToastModule to get static messages to show.

Will raise another issue but I saw the same issue with lazy loading a module with OvelayPanelModule, if I included ToastModule it worked...

ToastModule is including SharedModule, which the others are not... swapping the ToastModule for SharedModule in the lazy loaded module allow the pTemplate to be recognised in the overlay panel.

Suspect adding SharedModule to lazy loaded MessageModule packages would also fix this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Helayxa picture Helayxa  路  3Comments

papiroca-tm picture papiroca-tm  路  3Comments

pchristou picture pchristou  路  3Comments

lilling picture lilling  路  3Comments

Helayxa picture Helayxa  路  3Comments