ember.js - How to use valueBinding for toggle radio buttons? -
i have posted code here. here have used radio button define gender.
<div class="control-group"> <label class="control-label">gender</label> <div class="controls"> <p><div id="gendertype" name="gender" class="btn-group rdgender" data-toggle="buttons-radio"> <button type="button" class="btn btn-info">male</button> <button type="button" class="btn btn-info">female</button> </div></p> </div> </div>
i want implement binding in such way should support existing implementation of crud functionality.
but not able implement binding radio button in scenario(refer provided fiddle). can tell me how implement binding toggle radio buttons in scenario?
you can create view radio buttons , use class binding toggle active
class on specific button depending on gender
property
upd: can bind class on boolean property:
<button type="button" {{bindattr class=":btn :btn-info controller.currentcontact.male:active"}}>male</button> <button type="button" {{bindattr class=":btn :btn-info controller.currentcontact.male::active"}}>female</button> app.person = ds.model.extend({ firstname: ds.attr('string'), lastname: ds.attr('string'), gender: ds.attr('string'), contacttype: ds.attr('number'), male: function(){ return this.get('gender') == 'male'; }.property('gender') });
Comments
Post a Comment