salesforce / lwc

⚡️ LWC - A Blazing Fast, Enterprise-Grade Web Components Foundation
https://lwc.dev
Other
1.62k stars 394 forks source link

LWC embed in angular application #2159

Closed ajay312 closed 3 years ago

ajay312 commented 3 years ago

I have LWC component and it must render in angular component .Steps to follow embed Lwc in angular

pmdartus commented 3 years ago

I would recommend looking at https://developer.salesforce.com/blogs/2020/11/how-to-use-apex-natively-with-svelte-vue-and-preact-within-lwc.html explaining how to integrate other popular frameworks with LWC on Salesforce. This might work depending on how your Angular app is setup.

An alternative approach would be to use the lightning:container component (only available in Aura). This is the most straightforward approach to integrate third-party applications on Salesforce.

For further guidance, I would recommend posting your question StackExchange.

ajay312 commented 3 years ago

@pmdartus We have Angular application which is build on latest version .Could we use angular components in LWC application with out using Lightning container?

nolanlawson commented 3 years ago

@ajay312 You can use any third-party framework without lightning:container by using lwc:dom="manual". It looks like you can use a technique like this to render Angular components into arbitrary DOM elements.

Note though that if you are trying to embed an entire application that does its own routing, etc., then you will need lightning:container.

pmdartus commented 3 years ago

@ajay312 I would also recommend looking at this issue https://github.com/salesforce/observable-membrane/issues/59 if you are planning to load Angular in the same document as LWC. Zone.js aggressively patches some JavaScript APIs that might result in breaking LWC reactivity system in certain cases.