1
這只是我在表格中的基本輸入元素,我需要設置其默認初始值。如何在角度2中設置模板驅動窗體輸入的默認值?
<input type="number" name="interest_rate" [(ngModel)]="interest_rate">
在我的代碼,我添加
this.form.controls['interest_rate'].patchValue(this.assumptions.interest_rate*100);
但是我卻越來越
Error: Error in :0:0 caused by: Cannot read property 'patchValue' of undefined