sebastianha / angular-bootstrap-checkbox

A checkbox for AngularJS styled to fit the Twitter Bootstrap standard design
MIT License
148 stars 66 forks source link

checkbox default check. #28

Closed umair-khanzada closed 8 years ago

umair-khanzada commented 8 years ago

how checkbox default check i tried checked attribute and also try ng-checked attribute but not work.

sebastianha commented 8 years ago

Just set the model value to the default value you want. This should work.

umair-khanzada commented 8 years ago

but not have an attribute and also ng-checked="true" is not working for this. i work same like your trick.

ihamouda commented 8 years ago

Same issue, my ng-model value = 1, the check box is unchecked and the model value changes to 0

here is my checkbox `<checkbox ng-model="db.selectedGroup.is_primary" ng-true-value="1" ng-false-value="0"

`

and here is my object if the checkbox is not in the page group_description: "", group_id: "db1-cfb5df1c-6027-11e4-b1b7-525400b87f6d", group_name: "Execs", is_primary: 1

then here is my object again when the checkbox is in the page

group_description: "", group_id: "db1-cfb5df1c-6027-11e4-b1b7-525400b87f6d", group_name: "Execs", is_primary: "0"

any suggestions?

sebastianha commented 8 years ago

At a first look you are mixing strings and integers, could this be the problem?

is_primary is 1 (int) at first and then "0" (string)

sebastianha commented 8 years ago

Please reopen if the problem still exists