NoSoup4you
NoSoup4you

Reputation: 668

How can i call a function in Angular in a reactive form

I have a form element in my reactive form like below

 <form [formGroup] = "form" (ngSubmit)="handleClick()">

which works fine when i hit the submit bttn, but i have another bttn on the form from which i want to call a different function. I searched and could not find something that works. i tried something like this

 <button  ng-click=”newClick()” type=”button” class="btn survey-reset-btn">Get Info</button>

or

<button (click)=”newClick($event)” type=”button”>Button</button>

but that creates me an error and complains about the () around click.

sow how can i have bttn on my form which dont call the same function ?

Upvotes: 1

Views: 1622

Answers (1)

Durgesh Pal
Durgesh Pal

Reputation: 695

Might be the issue of quote symbol. Replace with ".

<button (click)="newClick($event)" type="button">Button</button>

Upvotes: 4

Related Questions