title: TypeError: _co.class.function is not a function
body: <p>I'm learning Angular 6 and I'm very new to it.<br>My object is to define a class function and then call it from the connected component, but I get the following error.</p>
  
  <pre><code>TypeError: _co.installation.selectOrDeselect is not a function
  </code></pre>
  
  <p><br><strong>installation.ts</strong></p>
  
  <pre><code>export class Installation {
      id: number;
      name: string;
      img: string;
      version: number;
      agents: number;
      ip: string;
      connection: string;
      selection:  string;
  
      selectOrDeselect() {
          if (this.selection == 'not-selected') {
              this.selection = 'selected';
          } else {
              this.selection = 'not-selected';
          }
      }
  }
  </code></pre>
  
  <p><strong>installations.component.ts</strong></p>
  
  <pre><code>import { Component, OnInit } from '@angular/core';
  import { Installation } from '../installation';
  
  @Component({
      selector: 'app-installations',
      templateUrl: './installations.component.html',
      styleUrls: ['./installations.component.css'],
  })
  export class InstallationsComponent implements OnInit {
      installation: Installation = {
          id: 1,
          name: 'Master',
          img: 'assets/logo.jpg',
          version: 7,
          agents: 95,
          ip: '192.168.0.1',
          connection: 'not-connected',
          selection: 'not-selected'
      };    
  
      constructor() { }
  
      ngOnInit() {
  
      }
  }
  </code></pre>
  
  <p><strong>installations.component.html</strong></p>
  
  <pre><code>&lt;div class=""class="col-2 installationContainer {{installation.selection}} {{ installation.connection  }}" (click)="installation.selectOrDeselect()"&gt;
      &lt;h3&gt;{{ installation.name }}&lt;/h3&gt;
      &lt;img src="{{ installation.img  }}"&gt;
      &lt;div&gt;&lt;label&gt;versione: &lt;/label&gt;{{ installation.version }}&lt;/div&gt;
      &lt;div&gt;&lt;label&gt;agenti: &lt;/label&gt;{{ installation.agents  }}&lt;/div&gt;
      &lt;div&gt;&lt;label&gt;ip: &lt;/label&gt;{{ installation.ip  }}&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>