我的以下代码触发addResult()
方法属性,但提交的属性始终为空。任何猜测?
<form class="form-horizontal" (ngSubmit)="addResult()" #resultForm="ngForm">
<p>is form submitted? {{resultForm.form.submitted}}</p>
...
<button type="submit" (click)="resultForm.ngSubmit.emit()" class="btn btn-primary" data-dismiss="modal" id="saveDialog">Sauvegarder</button>
</form>
答案 0 :(得分:0)
更改为
创建了Plunker
<form class="form-horizontal" (ngSubmit)="addResult(resultForm)" #resultForm="ngForm">
<p>is form submitted? {{resultForm.submitted}}</p>
...
<button type="submit" class="btn btn-primary" data-dismiss="modal" id="saveDialog">Sauvegarder</button>