title: ERROR TypeError: Cannot read property 'push' of undefined in TypeScript
body: <p>I have a basic problem with TypeScript. I have an error:</p>
  
  <pre><code>ERROR TypeError: Cannot read property 'push' of undefined
  </code></pre>
  
  <p>I have model <code>EmailModel</code>:</p>
  
  <pre><code>export class EmailModel {
  
      public name: String;
      public lastname: String;
      public address: String;
      public company: String;
      public zipcode: number;
      public city: String;
      public phonenumber: number;
      public email: String;
      public product: Array&lt;ProductModelOrder&gt;=[];
  
      constructor(name: String, lastname: String, address: String, company: String, zipcode: number, city: String, phonenumber: number, email: String,product: Array&lt;ProductModelOrder&gt;=[]) {
          this.name = name;
          this.lastname = lastname;
          this.address = address;
          this.company = company;
          this.zipcode = zipcode;
          this.city = city;
          this.phonenumber = phonenumber;
          this.email = email;
          this.product = product;
      }
  }
  </code></pre>
  
  <p>And my <code>product</code> array look like this:</p>
  
  <pre><code>export class ProductModelOrder {
      public name: String;
      public number: number;
      public pricePerProduct:number;
      public price:number;
  }
  </code></pre>
  
  <p>This is my <code>productOrder =&lt; ProductModelOrder&gt;{};</code> and  <code>emailModel = &lt;EmailModel&gt;{};</code> and I want productOrder to emailModel like this:</p>
  
  <pre><code>for (let prod of this.productCarts){
        this.productOrder.name = prod.product_name;
        this.productOrder.number = prod.numberOfProduct;
        this.productOrder.pricePerProduct = prod.product_price;  
        this.productOrder.price = this.priceForAllProducts; 
        this.emailModel.product.push(this.productOrder);
      }
  </code></pre>
  
  <p>And I have error.</p>