简体   繁体   中英

How do you disable a form input field using Angular Formly?

How do you disable a form input field using Angular Formly? I've googled and there is no clear cut answer. Indeed I have searched Formly's 'field configuration docs' and there is only one instance of the word 'disable' on that page, and it has nothing to do with actually disabling the field. Am I missing something?

By using the disabled option of templateOptions . Below is how I added this to one of my form fields:

{
    key: 'accountNumber',
    type: 'input',
    templateOptions: {
        label: 'Account #',
        disabled: true,
        required: true
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM