title: Can't access method from the model class in Angular 4
body: <p>I am trying to use method from the model class but its throwing error like </p>
  
  <blockquote>
    <p>ERROR TypeError: act.sayHi is not a function</p>
  </blockquote>
  
  <p>Here is my code</p>
  
  <blockquote>
    <p>Model Class myModelClass.ts</p>
  </blockquote>
  
  <pre><code>    export interface IMymodel {
          name: string;
          address: string;
          age: number;
      }
  
      export class Mymodel implements IMymodel {
          name: string;
          address: string;
          age: number 
  
          constructor() {}
  
          sayHi(name): string {
              console.log('Hiii' + name);
              return 'Hiii'+name;
          }
  
      }
  </code></pre>
  
  <blockquote>
    <p>Component MyComponent.ts</p>
  </blockquote>
  
  <pre><code>import { IMymodel, Mymodel } from '../model/myModelClass.ts';
  
  @Component({
      selector: 'my-component',
      templateUrl: 'myComponent.html'
  })
  export class MyComponent {
  
      ...
  
      prepareData(data: Array&lt;IMymodel&gt;): Array&lt;IMymodel&gt; {
  
           data.map((act: Mymodel) =&gt; {
               act.sayHi(act.name);
           });
  
           return data;
      } 
  
  }
  </code></pre>