title: How to reload the script present inside head tag of index.html in angular?
body: <p>I am searching so many solutions but I am unable to find one.</p>
  
  <p>I have written some script inside the <code>head</code> tag (above <code>&lt;/body&gt;</code> also I tried) in <code>index.html</code>. I have written <code>$(document).ready</code> function inside it.</p>
  
  <p>When the server starts that time the script will work. But until refreshing the page, the script will not work, when I come back from a different component to the component where the script is used.</p>
  
  <p>So my question is how can I refresh the <code>index.html</code>?.
  If I do so, the whole application gets refreshed. How to prevent it?
  Is there any different way to reuse my script code again and again it?
  Please provide me with a solution.</p>
  
  <p>I tried importing an external <code>js</code> file in <code>index.html</code>. That time function will not be invoked.
  I tried writing <code>js</code> code inside <code>AfterViewInit</code> lifecycle hook. That also did not work.</p>