【发布时间】:2018-12-11 10:47:59
【问题描述】:
我想将 api 调用中的属性传递给提交函数,但不确定它为什么不起作用。我认为这与选项选择或重新格式化输入有关。
遇到错误Error: No value accessor for form control with name: 'employee_id'
form.component.html
<select>
<option
*ngFor="let employee of employees"
name="employee_id"
[(ngModel)]="employee_id">
{{ employee.name }}
</option>
</select>
<button
(click)="submitMeetingRequirements()"
class="btn btn-success">
Suggest Meeting
</button>
这是来自form.component.ts的提交函数
submitMeetingRequirements() {
this._meetingService.submitMeetingRequirements(
this.employee_id)
.subscribe(res => this.suggestions = res["suggestions"])
}
【问题讨论】:
标签: html angular typescript api angular-ngmodel