title: ERROR ReferenceError: TradingView is not defined
body: <p>I am trying to show TradingView's widget on my Angular app using following codes:</p>
  <p>technical.component.html:</p>
  <pre><code>  &lt;div class=&quot;tradingview-widget-container&quot; style=&quot;width: 2000; height: 2000; margin-bottom: 100px;&quot;&gt;
      &lt;div id=&quot;tradingview_bac65&quot;&gt;&lt;/div&gt;
      &lt;script type=&quot;text/javascript&quot; src=&quot;https://s3.tradingview.com/tv.js&quot;&gt;&lt;/script&gt;
      
      &lt;script type=&quot;text/javascript&quot;&gt;
  
      &lt;/script&gt;
    &lt;/div&gt;
  </code></pre>
  <p>technical.component.ts:</p>
  <pre><code>import { Component, OnInit, AfterViewInit } from '@angular/core';
  
  declare const TradingView: any;
  
  @Component({
    selector: 'app-technical',
    templateUrl: './technical.component.html',
    styleUrls: ['./technical.component.scss']
  })
  export class TechnicalComponent implements OnInit, AfterViewInit {
  
    constructor() { }
    ngOnInit() {
  
    }
  
    ngAfterViewInit(){
      new TradingView.widget(
        {
        &quot;width&quot;: 980,
        &quot;height&quot;: 610,
        &quot;symbol&quot;: &quot;BTCUSD&quot;,
        &quot;timezone&quot;: &quot;Etc/UTC&quot;,
        &quot;theme&quot;: &quot;Light&quot;,
        &quot;style&quot;: &quot;1&quot;,
        &quot;locale&quot;: &quot;en&quot;,
        &quot;toolbar_bg&quot;: &quot;#f1f3f6&quot;,
        &quot;enable_publishing&quot;: false,
        &quot;withdateranges&quot;: true,
        &quot;range&quot;: &quot;ytd&quot;,
        &quot;hide_side_toolbar&quot;: false,
        &quot;allow_symbol_change&quot;: true,
        &quot;show_popup_button&quot;: true,
        &quot;popup_width&quot;: &quot;1000&quot;,
        &quot;popup_height&quot;: &quot;650&quot;,
        &quot;no_referral_id&quot;: true,
        &quot;container_id&quot;: &quot;tradingview_bac65&quot;
      }
        );
  
  }
  
  
  }
  </code></pre>
  <p>technical.component.scss:</p>
  <pre><code>.example-form {
      min-width: 150px;
      max-width: 500px;
      width: 70%;
    }
    
    .example-full-width {
      width: 70%;
    }
  
    .center {
      display: flex;
      justify-content: center;
    }
  
    .margins {
      width: 100%;
      margin-top: 20px;
      margin-bottom: 20px;
  }
  </code></pre>
  <p>But it doesn't show the widget in the browser and I see the following error in the console:</p>
  <pre><code>ERROR ReferenceError: TradingView is not defined
  </code></pre>
  <p>I must mention that this code was working on my previous app and just copied it in my new app bud doesn't work!</p>