简体   繁体   中英

Angularjs checkbox checked in ng-repeat

repeat to show the checkbox with box as checked if value is true and unchecked if it is false. My code is

                          <tr ng-repeat="aa in allcheckboxes">                         
                                <input type="checkbox"  ng-model="item.sticky" ng-show="{{aa.allowoption}}">                            
                            </div>
                        </tr>

I tried to do it using ng-show it didnt work. Can you please tell me how I can show the checkbox checked for when aa.allowoption is true and unchecked for flase. Thanks

I believe you are looking for ng-checked:

<INPUT ng-checked="{{aa.allowoption}}">

Happy coding :)

You can use either ng-checked or ng-true-value http://jsfiddle.net/eCJ47/

<input type="checkbox" ng-model="a.type" ng-true-value="a">

Here's the doc for this http://docs.angularjs.org/api/ng.directive:input.checkbox

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM