formly-js / angular-formly-templates-bootstrap

Angular-Formly: Bootstrap Templates
http://formly-js.github.io/angular-formly
MIT License
110 stars 81 forks source link

Radio elements disabled #100

Open netowp opened 8 years ago

netowp commented 8 years ago

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 commented 8 years ago

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