function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Yoann Boutin 2Yoann Boutin 2 

Angular component integration using LCC, issue with addMessageHandler

Hi,

So as i said in the title, my need is to integrate an Angular component into Salesforce, so i successfully did it by importing my built component into Salesforce as a static resource and then using it in a lightning container in a Lightning Component.

What i need now is to be able to communicate from the Lightning Component to the Angular app to share some data. So i added to my Angular app the NPM package: LCC

I know that i need to use the addMessageHandler in my Angular app to be able to receive messages sent from my Lightning Component, but i don't know if i'm doing it correctly because i'm receiving correctly the message in the Angular app, but then if i want to update a variable in the Angular app using the values received in the message it seems that it is not.
For example, in the Angular app html i'm displaying a variable in a text field, if i send a message from the Lightning Component to be able to update this content it seems that i'm receiving the value but when i assign this new value to my variable in the angular app (this.value = message.value) my DOM is not updated, meaning it will not display the new value received, do i miss something ?

I found several example with React but i did not found any concrete example on how and where to define the addMessageHandler in an Angular app, so i wanted to know if you could help me with that, if you have any example to share or any documentation more focused on Angular.

Don't hesitate to ask me if you need anything else to help me.

Best regards
Yoann Boutin 2Yoann Boutin 2
Hi,
Well finally i found the solution to my problem, seems Angular is not detecting by itself changes done when receiving the message from LCC, so we just need to add ChangeDetectorRef.detechChanges() at the end of the addMessageHandler in the Angular app.

Regards