When ng-checked is true, the checkbox in my HTML should also be checked. It seems like this only happens during initialization and not after.
I am noticing a discrepancy between ng-checked and what is displayed in the browser.
var app = angular.module('MyApp',[]);
app.controller("MyCtrl", function($scope) {
$scope.testCheckedState = true;
$scope.isTestChecked = function(){
return $scope.testCheckedState;
};
$scope.forceCheck = function(){
$scope.testCheckedState = true;
};
});
<!DOCTYPE html>
<html>
<head>
<script data-require="angular.js@*" data-semver="1.3.8" src="https://code.angularjs.org/1.3.8/angular.js"></script>
</head>
<body ng-app="MyApp">
<div ng-controller="MyCtrl">
<input type="checkbox" ng-checked="isTestChecked()" ng-click="forceCheck()" />
<br />
isTestChecked: {{isTestChecked()}}
</div>
</body>
</html>
I am confused by what could be causing this difference in states?
Thank you, RoD