我有一个反应形式,其中我使用了表格数组和所有,但现在我只需要获取细节,并且必须只读取。 我尝试了[readonly] =“true”,但它没有使用select。所以有人可以帮我解决这个问题。
答案 0 :(得分:0)
使用[disabled]="true"
<select [disabled]="true" class="col-lg-6 col-md-6 col-sm-6 col-xs-6" formControlName="Relationship">
<option *ngFor="let relation of relations" [value]="relation.StatusId">{{relation.Description}}</option>
</select>
答案 1 :(得分:0)
你可以在创建表单控件时从ts文件中执行此操作,如
this.bookForm = this.fb.group({
id: null,
title: [{ value: '', disabled: true }]
});
答案 2 :(得分:0)
你可以写this.emergencyContactForm.get('Phone').disable();