Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Would like to use btn-checkbox in place of all my checkboxes on a form. I am looking for the syntax to make a generic reference to the value of the bound property from within the attributes, in this case ng-class.

<button type="button" 
        ng-class="{true: 'btn btn-success', 
                   false:'btn btn-checkbox-off'}
                   [vm.csrMain.doubleAggregate]" 
        ng-model="vm.csrMain.doubleAggregate"
        btn-checkbox btn-checkbox-true="true" btn-checkbox-false="false">
        DOUBLE AGGREGATE
</button>

( using ctrl as vm syntax ) The code above works, but I want to make a generic reference to the value of the ng-model in the brackets where I am hard coding the bound property [vm.csrMain.doubleAggregate] something like [ng-model.$value]

Tried to do a plunker here. Not sure why I can't get the btn-checkbox behavior I get successfully in the code above. If someone could guide me on that as well I'd appreciate it as this my first shot at a plunk from scratch plunker

share|improve this question
1  
can you setup a plunker.. i will try to convert it to reusable directive –  HarishR Aug 2 at 5:35
    
Thank you Harish. While i've used plunker a lot to play with other people's plunks this is the first time I've tried to create one from scratch. link Notes in description and md. Works in my app but I may have set up plunk wrong as I don't get btn-checkbox behavior. Changed versions of bootstrap and ui-bootstrap to match my app. –  Charles Hankey Aug 2 at 15:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.