我有一个场景,其中输入字段中的 应该接受数组中存在的值。如果添加其他值,它应该抛出错误。
.component.html
<input type="text" ([ngModel])="InputValues" (blur)="validate()">
.component.ts
arrayList = ['table_1', 'table_2', 'table_3', 'table_4'];
arrayList 有 4 个元素,输入字段应仅接受此值,如果输入任何其他值,则应抛出错误。输入应该接受 arrayList 中存在的值。
RISEBY
潇潇雨雨
FFIVE
相关分类