Skip to content
This repository has been archived by the owner on Apr 30, 2018. It is now read-only.

Radio elements disabled #100

Open
netowp opened this issue Jun 17, 2016 · 1 comment
Open

Radio elements disabled #100

netowp opened this issue Jun 17, 2016 · 1 comment

Comments

@netowp
Copy link

netowp commented Jun 17, 2016

Radio elements are always greyed out (disabled) on my forms.

I'm using angular version 1.5.6, angular-formly version 8.2.1 and angular-formly-templates-bootstrap 6.3.2.

image

formlyConfigProvider.setType({
    name: 'horizontalRadio',
    extends:'radio',
    overwriteOk: true,
    wrapper: ['horizontalBootstrapRadio', 'bootstrapHasError']
})
formlyConfigProvider.setWrapper({
    name: 'horizontalBootstrapRadio',
    template: ['',
        '<label for="{{::id}}" class="col-sm-2 control-label">',
            '{{to.label}} {{to.required ? "*" : ""}}',
        '</label>',
        '<div class="col-sm-10">',
        '<formly-transclude></formly-transclude>',
        '</div>'
    ].join(' ')
})
app.controller('assessmentController', function () {
    var vm = this

    vm.rental = {}

    vm.fields = [
        {
            "key": "triedEmber",
            "type": "radio",
            "templateOptions": {
                "label": "Have you tried EmberJs yet?",

                "options": [{
                        "name": "Yes, and I love it!",
                        "value": "yesyes"
                    },
                    {
                        "name": "Yes, but I'm not a fan...",
                        "value": "yesno"
                    },
                    {
                        "name": "Nope",
                        "value": "no"
                    }
                ]
            }
        }
    ]
    <form class="form-horizontal" novalidate>
        <formly-form model="vm.rental" fields="vm.fields" form="vm.rentalForm">
            <button type="submit" class="btn btn-primary" ng-disabled="vm.rentalForm.$invalid">Submit</button>
        </formly-form>
    </form>
@kentcdodds
Copy link
Member

Thanks for your interest in angular-formly. The best way to get help is by following the instructions at help.angular-formly.com.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants