javascript - Angularjs checkbox checked in ng-repeat - Stack Overflow

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

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

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

Share Improve this question asked Feb 11, 2014 at 0:43 J. DavidsonJ. Davidson 3,31714 gold badges56 silver badges105 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 3

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/eCJ47/

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

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745402432a4626162.html

相关推荐

  • javascript - Angularjs checkbox checked in ng-repeat - Stack Overflow

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

    2小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信