Q: Angular 4 TypeError: _co.submitData is not a function Here is click event from HTML file acc.component.html.
  <div>
          <label>Sub Distributor Name</label>
          <input  type="text" name="name" id="name" [ngModel]="name">                         
 </div>

 <div>
 <button (click)="submitData();">
 </div>

I call click event function from AccComponent.ts file in below way
import { Component } from '@angular/core';    

@Component({
  templateUrl: './acc.component.html',
  styleUrls: ['./acc.component.css']
})
export class AccComponent  {
  constructor() {}
  submitData() {
    console.log('I am in function');
  }
}

but I am getting this error
TypeError: _co.submitData is not a function  

When I change function name submitData() to submitData1(), the same functionality works. How is that possible?

A: What if you change the function to this?
 submitData = function (){
 console.log('I work!');
}

