1
我使用有角度的formly創建窗體。我已經動態地添加了使用有角度的形式重複節的添加按鈕上的選擇字段和文本區域。Angular Formly - 如果在前一個選擇字段中已經選擇了選項,則選擇字段應該會出錯
要求 - 從多個選擇字段中,每個選擇字段都應該選擇唯一的選項。
像「貨幣已經選擇了」
Controller.js
$scope.formFields = [ {
type: 'repeatSection',
key: 'details',
templateOptions: {
btnText:'Add ',
fields: [
{
className: 'row',
fieldGroup: [
{
type: 'select',
key: 'currency',
wrapper: 'loading',
templateOptions: {
label: $translate.instant('CURRENCY'),
valueProp: "value",
labelProp: "name",
options: [
{name: "Rupee", value: "INR"},
{name: "Doller", value: "$"},
{name: "Pound", value: "Pound"}
] ,
required: true,
placeholder: $translate.instant('SELECT TYPE FROM LIST'),
}
},
{
type: 'textarea',
key: 'debitNote',
templateOptions:
{
label: $translate.instant('DEBIT NOTE'),
rows: 4
}
}
]
}
]
}
}
];
謝謝benoror!這個答案真的幫我解決了這個問題。 – Abhijeet