Hi, I am trying to add Hubspot to Angular 8. I added the script in index.html and its works fine but I want to add Hubspot in one component only so how can I add HubSpot in particular components HTML or TS file? Please help me in this. Thank you
So before explaining what he was asking I would need to explain the Angular structure first.
In Angular, we have a "base" HTML file named "index.html" where you can apply the js code for global use. As he put the code there, users will be able to access Hubspot on all the pages he has.
And component is a minor part of Angular that only loads when needed. It contains a HTML file, a ts file and sometimes a css file. That component does not support js.
So what he was asking is if there is a way he can allow Hubspot only loads when certain component loads, and remove it when the component is removed from the page. In my mind the easiest way to do so is to install Hubspot as a NPM package if possible. But I cannot find such a package at the moment.
I am facing the same issue for now. It would be helpful if you can reply this.