[英]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. 当我点击submit bttn时,它可以正常工作,但是我要从中调用另一个函数的表单上还有另一个bttn。 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 ? 播种我怎么在我的表格上没有调用相同的功能呢?
Might be the issue of quote symbol. 可能是报价符号的问题。 Replace
”
with "
. 将
”
替换为"
。
<button (click)="newClick($event)" type="button">Button</button>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.