Saturday, 26 January 2019

How to include the script only to the component?

I angular app I have form component which is dependent on an external script to work properly,

I know that to include the external script in the angular we can do one of the following:-

  1. make an entry in angular.json file
  2. include the script in index.html
  3. include the script file in component.html file
  4. import the script in component.ts file

All the above method include script globally, and it does not work when the component is not loaded.

I want script attached to the component to run every time it is loaded/routed. all CSS is working fine.

Is there any way to make external script local to component and re-run the script every time it is loaded?



from How to include the script only to the component?

No comments:

Post a Comment