0
Hello.
I was implementing a notification component to present, on a screen, successful or error messages for user operations.
It is based on a Subject
in a Service
shared, where it feeds a list into an HTML that becomes a child of the header component. The problem is that when I publish a new alert, in this Subject, the screen does not update, because the change in the attribute is not being detected, I have tried approaches with the use of NgZone
and ChangeDetectorRef
, but none of them worked.
Could you help me?
All the code is in this repository.
It is difficult to understand the dislikes in the question, it is categorized correctly and I searched thoroughly before publishing only that cases similar to mine usually point solution with this Changedetectorref which did not work in my case, in addition the code for consultation and reproduction is all in the attached repository, if you do not have the answer simply ignore the question or point out the error and ask for the detailing, do not declassify for free as this decreases the visibility of the same, complicated dealing with the ill will of some
– Renan Fernandes
I don’t quite understand your question, but you want to use the same
Component
of messages in other Components? If so, I think this video can help you (or their sequence, up to 90) https://www.youtube.com/watch?v=5c7qo26j728&list=PLGxZ4Rq3BOBoSRcKWEdQACbUCNWLczg2G&index=82&t=0s– Edward Ramos
Please post the code referring to the question of external links
– Eduardo Vargas
Right @Eduardovargas, I will pay attention to this, but I imagine that in the case of several related files becomes simpler and less verbose the question only relating the repository but I will follow its guidance
– Renan Fernandes
@Edwardramos is just another layout component like the header or footer but for the purpose of displaying alerts issued by certain actions in the system, the problem is that changes in attributes linked to this component are not reflected on screen because the detection is not notifying the template, but I will look at the series of videos yes to see if there is another approach, thank you
– Renan Fernandes
The ideal is that all the code needed to reproduce the problem is in the question itself, and links are only complements - please read the FAQ, which better explains all the reasons. If the original code is too large, try to reduce it to a [mcve].
– hkotsubo