title: Typescript - null array reference
body: <p>I'm writting application in typescript/angular and i have a service which get json with data and i'd like to display this downoad objects, but it can occur that objects can be more than i can display in one html component so i should split this array of objects. By the way before that i should filtering all objects from json by ip address, so i write component like that:</p>
  
  <pre><code>export class ServerBoxComponent implements OnInit {
  
    pods = new Array&lt;Pod&gt;();
  
    @Input() node_s: NodeServer;
  
    getPods() {
      // console.log('Download pods');
      this.httpService.getPods().subscribe(data =&gt; {
        this.pods = data.items;
      });
      console.log('Download status: ' + this.pods.length);
    }
  
    filtering() {
      console.log('Node_s length: ' + this.node_s.status.addresses[1].address);
      console.log('Node_s length: ' + this.pods.length);
      for (let i = 0; i &lt; this.pods.length; i++) {
        if (this.node_s.status.addresses[0].address === this.pods[i].status.hostIP) {
          console.log(this.pods[i].metadata.name);
          // this.node_s.podArray.push(this.pods[i]);
        }
      }
    }
  
    ngOnInit() {
      this.getPods();
      // this.filtering();
    }
  
    constructor(private httpService: HttpService) { }
  
  }
  </code></pre>
  
  <p>but i can't use filtering function because the pods array is empty, but why??</p>