initsForm() {
this.form = this.fb.group({
coffee: ['0', [
Validators.min(0)
]],
tea: ['0', [
Validators.min(0)
]]
})
this.countAmount();
}
countAmount() {
this.form.valueChanges.subscribe(val => {
Object.keys(this.form.controls).forEach(key => {
console.log((this.form.get(key).value * 1.75))
})
})
}
此控制台日志修改了每个输入值后的更改,但我需要控制台日志中所有输入的总数。我该怎么做?