Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

ng-checked is not working

I have a form with Checkbox and I want to dynamically check based on the database. It doesn’t work properly using ng-checked or ng-model. Then I figured out its working as expected while setting ng-true-value strictly.

Generally, possible to set the value to ng-false-value & ng-true-value as number and as well string.

Example:  ng-false-value=0, ng-true-value=1

To make it strict, Use the constant expression

Example: ng-false-value=”’0’”, ng-true-value=”’1’”

HTML:

AngularJs:

$scope.checkbox = 1;

Now if you look at this checkbox will be checked by default.

The post ng-checked is not working appeared first on Drtuts.



This post first appeared on Drtuts, please read the originial post: here

Share the post

ng-checked is not working

×

Subscribe to Drtuts

Get updates delivered right to your inbox!

Thank you for your subscription

×