Button Click event not working in AngularJS 2

Last Reply 11 months ago By pandeyism

Posted 11 months ago

Hi all,

Below the code for ts and html file , for this button click

is not working,' please help me,

html

<button mat-button color="primary" (click)="OnAddnepost()">Primary</button>

 

export class EmpsComponent {
  constructor() { }
  newpost = '';
  OnAddnepost(postinput: HTMLTextAreaElement) {
     console.log(postinput);
  }
}

 

Posted 11 months ago Modified on 11 months ago
sanvi says:
OnAddnepost(postinput: HTMLTextAreaElement) {

 Please remove the parameter and check.

export class EmpsComponent {
  constructor() { }
  newpost = '';
  OnAddnepost() {
     
  }
}

Refer below link.

https://stackoverflow.com/questions/42952355/angular-2-click-event-doesnt-work?rq=1