你的浏览器禁用了JavaScript, 请开启后刷新浏览器获得更好的体验!
输入关键字进行搜索
搜索:
markAsDirty
FormGroup
没有找到相关结果
冰洋
赞同来自:
Object.keys
Object.keys/this.form.controls/.forEach/key => { this.form.get/key/.markAsDirty//; }/;
Object.keys/this.form.controls/.forEach/key => { this.form.controls[key].markAsDirty//; }/;
龙天
for /const field in this.form.controls/ { // 'field' is a string const control = this.form.get/field/; // 'control' is a FormControl }
江南孤鹜
public markControlsDirty/group: FormGroup | FormArray/: void { Object.keys/group.controls/.forEach//key: string/ => { const abstractControl = group.controls[key]; if /abstractControl instanceof FormGroup || abstractControl instanceof FormArray/ { this.markControlsDirty/abstractControl/; } else { abstractControl.markAsDirty//; } }/; }
八刀丁二
get
for /const field in this.myForm.controls/ { // 'field' is a string console.log/this.myForm.controls[field].value/; }
帅驴
public touchAllFormFields/formGroup: FormGroup/: void { Object.keys/formGroup.controls/.forEach//key/ => { formGroup.get/key/.markAsDirty//; }/; }
诸葛浮云
Object.keys/ this.registerForm.controls/.forEach/key => { this.registerForm.controls[key].markAsDirty//; }/;
卫东
private markFormGroupTouched/formGroup: FormGroup/ { Object.keys/formGroup.controls/.forEach//key/ => { const control = formGroup.controls[key]; control.markAsDirty//; if //control instanceof FormGroup// { this.markFormGroupTouched/control/; } }/; }
三叔
{"conditionGroups": [ { "order": null, "conditions": [] } ] } updateFormData// { const control = <formarray>this.form.controls['conditionGroups']; control.value.map//x,index/=>{ x.order = index; }/
要回复问题请先登录或注册
8 个回复
冰洋
赞同来自:
可以应对它..
为了 Angular 8+ 使用以下内容 /基于答案Michelangelo/:
龙天
赞同来自:
Object.keys/.../
:
江南孤鹜
赞同来自:
八刀丁二
赞同来自:
不再有效地提取表单中的某些值 Angular 8, 这就是我根据答案决定它的方式 @Liviu Ilea.
帅驴
赞同来自:
我希望这个能帮上忙 ;/
诸葛浮云
赞同来自:
卫东
赞同来自:
三叔
赞同来自:
我有控制命名 'order', 我给了他一个指数。
</formarray>