One option is to embed the code directly into the HTML, and the other best solution is to create a Component.
Embedding code anywhere on the page
This is a familiar option and the easiest way to go. So you can just access the html on any of your Angular files and paste the EmbedSocial code directly.
Here's an example:
2. Creating a Component
There are two steps you need to follow to achieve this:
Create the component
Use the component
1. In the terminal, use the following command `ng generate component EmbedSocialWidget` to create an angular component called `EmbedSocialWidget`
2. After the component is created, open `EmbedSocialWidget.component.ts` and add an `@Input() decorated` string called `refId` just above the constructor.
Your component file `EmbedSocialWidget.component.ts` should look like the image below:
Using the component
The data-ref attribute should look like this:
Once you have the data-ref, you can use the newly created `EmbedSocialWidget` component freely anywhere within your angular project. Just edit the component’s `refId` binding with the refId you copied from EmbedSocial before.
Here is an example of using the component: