title: How to call external javascript file from typescript method in ionic?
body: <p>I have a json list in a javascript file and I want to filter it in typescript before sending the array of results to the html home page. However, I got an error in the html file.</p>
  <p>Note: I tested my code with an online typescript editor and it worked perfectly.</p>
  <p>Javascript File list.js</p>
  <pre><code>   var jsonList= [
    {
      &quot;Answer&quot;: &quot;Y&quot;,
      dummyProp1 : 1
    },
  {
      &quot;Answer&quot;: &quot;N&quot;,
      dummyProp1 : 1
    }];
  </code></pre>
  <p>Typescript file: home.ts</p>
  <pre><code>import { Component,OnInit } from '@angular/core';
  import 'src/assets/list.js';
  
  declare var list:any[];
  declare var jsonlist:any[];
  
  @Component({
    selector: 'app-home',
    templateUrl: 'home.page.html',
    styleUrls: ['home.page.scss'],
  })
  export class HomePage implements OnInit {
  
    constructor() {
    }
  //extract only yes answers
  
  ngOnInit() {
    function filterJson() {
      return this.list.filter(e =&gt; (
        (e.Answer.indexOf('Y') === 0) 
      ))
    }
    
    var o = filterJson();
    
    //get only Answers
    
    for(var key in o) {
      var infoJSON = o[key];
      jsonlist.push(infoJSON.Answer)
    }
    
    console.log(jsonlist);
  }
  }
  </code></pre>
  <p>home index file:</p>
  <pre><code>&lt;body&gt;
    &lt;app-root&gt;&lt;/app-root&gt;
    &lt;script type=&quot;text/javascript&quot; src=&quot;src/assets/list.js&quot;&gt;&lt;/script&gt;
  &lt;/body&gt;
  </code></pre>
  <p>home page file: home.html</p>
  <pre><code>&lt;div *ngFor=&quot;let item of jsonlist&quot;&gt;
  &lt;ion-item&gt;
    &lt;ion-label&gt;&lt;b&gt;{{item}}&lt;/b&gt;&lt;/ion-label&gt;
  &lt;/ion-item&gt;
  </code></pre>
  
  <p>Error :
  Property 'jsonlist' does not exist on type 'HomePage'.ngtsc(2339)
  home.page.ts(11, 49): Error occurs in the template of component HomePage.</p>