angularangular-formly

Angular Formly - Disable individual Radio Options


I'm trying to disable one Radio Button (e.g the first one) Option trough angular formly Fields.

          options: [
            {
              value: 1,
              label: 1,
            },
            {
              value: 2,
              label: 2
            },
            {
              value: 3,
              label: 3
            }
          ]

This doesn't work

                {
                  value: 1,
                  label: 1,
                  disable: 'true' //also tried true or 'disabled'
                },

I have also tried the following, unfortunately without success

        hooks: {
          onInit: (field) => {
            field.expressionProperties.options[0].disabled = true;
          }

Anyone have some ideas how can I achieve this? In HTML it would be easy to set the disabled="disabled" attribute..


Solution

  • The problem was my outdated @ngx-formly/core Version

    I updated from 5.5.1 to 5.10.1 and it works now