title: How to move code from index.html to component?
body: <p>I had the code below placed in the <code>index.html</code> and it works.</p>
  <pre><code>&lt;!-- Smartsupp Live Chat script --&gt;
  &lt;script type=&quot;text/javascript&quot;&gt;
      var _smartsupp = _smartsupp || {};
      _smartsupp.key = '';
      window.smartsupp ||
          (function (d) {
              var s,
                  c,
                  o = (smartsupp = function () {
                      o._.push(arguments);
                  });
              o._ = [];
              s = d.getElementsByTagName('script')[0];
              c = d.createElement('script');
              c.type = 'text/javascript';
              c.charset = 'utf-8';
              c.async = true;
              c.src = 'https://www.smartsuppchat.com/loader.js?';
              s.parentNode.insertBefore(c, s);
          })(document);
  &lt;/script&gt;
  </code></pre>
  <p>How can I move that code to be executed from inside a component?</p>
  <p>I tried put the code inside a function for example ngAfterViewInit() but I get errors like <code>Property 'smartsupp' does not exist on type 'Window &amp; typeof globalThis'.</code></p>
  <pre><code>export class AppComponent  {
    
  
    ngAfterViewinit(){
  
      var _smartsupp = _smartsupp || {};
          _smartsupp.key = '';
          window.smartsupp ||
              (function (d) {
                  var s,
                      c,
                      o = (smartsupp = function () {
                          o._.push(arguments);
                      });
                  o._ = [];
                  s = d.getElementsByTagName('script')[0];
                  c = d.createElement('script');
                  c.type = 'text/javascript';
                  c.charset = 'utf-8';
                  c.async = true;
                  c.src = 'https://www.smartsuppchat.com/loader.js?';
                  s.parentNode.insertBefore(c, s);
              })(document);
   
    }
  
  }
  </code></pre>