0
             <tr> 
             <td><input type="checkbox" ng-model="<%=cat4%>" ng-checked="true"> </td>
            <td>
            <%=cat2%>
             </td>
             <td><input type="text" class="txt" ng-show="<%=cat4%>" placeholder="Enter Price per <%=cat2%>" value="<%=temps[i]%>"></td>    
            </tr>

I want to display the text box when checkbox is checked. The checkbox is by default checked. When the check box is unchecked then the text box should be hidden. Using the above code the checkbox is checked but the textbox is not displayed (when the form loads). When I uncheck and again check the checkbox then only the text box is displayed. What changes are needed in the code?

3
  • this may help you jsfiddle.net/ucmL2 Commented Apr 10, 2016 at 7:05
  • putting ng-checked="true" and running the code, the checkbox is checked but text box is not displayed in above link. Commented Apr 10, 2016 at 7:10
  • ngModel and ngChecked are not meant to be used together try this stackoverflow.com/questions/16601018/… Commented Apr 10, 2016 at 7:17

1 Answer 1

0

unchecking it doesn't make it false

use ng-change to turn it for false to true and vice versa

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.