0

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

2 Answers 2

3

I believe you are looking for ng-checked:

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

Happy coding :)

Sign up to request clarification or add additional context in comments.

1 Comment

I wish I could think of everything like the Angular team. You can almost just assume a feature is there and it just is.
1

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

2 Comments

this is fine. But my values are coming in from ng-repeat. So the values are like aa.allowoption
Yup, added for completeness to the correct post by @ForegetfulFellow . ng-checked looks like your solution.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.