【发布时间】:2020-03-08 02:14:38
【问题描述】:
我正在研究角度反应形式。我使用模型如context 在表单中填写初始值,类似这样
this.form = this.formBuilder.group({
name: [this.context.name],
age: [this.context.age],
place: [this.context.place],
school: [this.context.school]
});
我想在表单提交时将数据存储回context 模型。我正在做这样的事情。有什么优雅的方法可以做到这一点。
this.context.name = this.form.value.name;
this.context.age= this.form.value.age;
this.context.place= this.form.value.place;
this.context.school= this.form.value.school;
【问题讨论】:
标签: angular angular-reactive-forms