如果我打开表单并更改输入字段“城市”并单击取消。之后,如果我再次打开表单,默认值会更改。如何在表单字段中获取该默认值?
零件
city:string = 'Chennai'
模板
<form (ngSubmit)="f.form.valid && editUserCity()" #f="ngForm" novalidate>
<input type="text" name="city" [(ngModel)]="city" class="form-control"
placeholder="City" required #city="ngModel"
[class.is-invalid]="f.submitted && city.invalid"
>
<button type="submit" class="greenbutton upperCase w200px">Save</button>
</form>