javascript - Checkbox is not showing checked when setting value to true -
i using icheck in angular application, have basic checkbox when checked shows image. works ng-show, when set value true within controller doesn't return checked when page loaded.
controller
$scope.basicintake = {}; $scope.basicintake.insurance_cover = true;
html
<div class="row"> <div class="form-group col-lg-6"> <div class="col-lg-12"> <label> <input icheck type="checkbox" ng-model="basicintake.insurance_cover"> click see image </label> </div> </div> <div class="form-group col-lg-6"> <div class="col-lg-12"> <img ng-src="http://i.imgur.com/vkw3lhe.jpg" class="img-responsive img-thumbnail" ng-show="basicintake.insurance_cover"> </div> </div> </div>
this because template not bound controller directive ng-controller
. properties not created till make event. : click
.
see attached fiddle , try connect. try remove ng-controller
top div
problem.
further: there no need have ng-checked
, when have ng-model
Comments
Post a Comment