-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<p-toast> is not working globally. #14422
Comments
Hi, Could you please share a stackblitz example so we can identify the issue? |
We're unable to replicate your issue, if you are able to create a reproducer by using PrimeNG Issue Template or add details please edit this issue. This issue will be closed if no activities in 20 days. |
okay
I have updated the code.
I have multiple modules, so I want Toaster to inject from shareModule using
the service file as you can see in example code.
01 - Toaster not showing.
02 - <p-toast></p-toast> (I want to use this only in one html no all
component HTML Files)
03 - Can you please make this example working, usin share module in all
module and we can only call this <p-toast></p-toast> app.component.html
Thanks
…On Fri, Jan 5, 2024 at 5:39 PM github-actions[bot] ***@***.***> wrote:
We're unable to replicate your issue, if you are able to create a
reproducer by using PrimeNG Issue Template
<https://stackblitz.com/github/primefaces/primeng-issue-template> or add
details please edit this issue. This issue will be closed if no activities
in 20 days.
—
Reply to this email directly, view it on GitHub
<#14422 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHJXEPQIKOUKJXP5TFEGBVTYM7X63AVCNFSM6AAAAABA66Q7ACVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZYGYYDGMJXGE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
You don't need to add it to 100 places, just create a shared module or import at the top level. 1- import toast module to the top level module It should be something like that:
|
No,
This is not working for me.
Please check example code, I have set all code using shared Module.
Link -
https://stackblitz.com/edit/github-mv9zck
…On Mon, Jan 8, 2024 at 11:58 AM Çetin ***@***.***> wrote:
Closed #14422 <#14422> as
completed.
—
Reply to this email directly, view it on GitHub
<#14422 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHJXEPUEI7KDTUDTCVMAO2LYNOKHXAVCNFSM6AAAAABA66Q7ACVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJRGQYTGOBTGU3DAMI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I've encountered the same problem in angular 17 (standalone app). |
@yvkevitch would you please explain more. |
@Fourat-Khelifi |
There's still a problem. Capturing the error globally with ErrorHandler and calling MessageService on it, Toast does not appear, only if I click on the screen.
|
Hi @reidecarvalho same issue here and I think it’s related to the ChangeDetectionStrategy for the toast component, which is using OnPush, so maybe a temp fix could be to force the change detection using: constructor(private ref: ChangeDetectorRef) {} in your AppMessageService and then: this.ref.detectChanges(); in every method, for example: error(message: string): void { |
Describe the bug
I have multiple modules with components. I have included the toaster in the shared module and am using it in the required modules. However, the issue I am facing is that I want to set the HTML globally in app.component.html or layout.component.html. Additionally, I want it to work in sub-components without having to add it to each sub-component's HTML file. Why do I need to add this to all 100 components?
Environment
Environment Information
Angular Version: [e.g., 16.1.0]
PrimeNG Version: [e.g., 16.0.2]
Browser(s): [e.g., Chrome, Firefox]
Operating System: [e.g., Windows 10]
Reproducer
No response
Angular version
16.1.0
PrimeNG version
16.0.2
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
16
Browser(s)
All
Steps to reproduce the behavior
You have multiple modules, each containing components. The toaster component is included in a shared module and is being utilized in the required modules. However, you are encountering an issue where you want to globally set the HTML in either app.component.html or layout.component.html. Additionally, you desire this global setting to automatically apply to sub-components without having to add it individually to each sub-component's HTML file. This becomes particularly cumbersome when dealing with a large number of components (in your example, 100 components), and you are questioning the necessity of manually adding this code to each one.
Expected behavior
No response
The text was updated successfully, but these errors were encountered: