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:-
- make an entry in
angular.json
file - include the script in
index.html
- include the script file in
component.html
file - 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?