when i use angular1.6,a checkbox is checked on page loaded,but i click the checkbox ,the checkbox model is not update. why ?
code:
var app = angular.module("demo",[]);
app.controller("ctrl",["$scope",function($scope){
var data = {
C_DJB:{VAL:'1'}
}
$scope.obj = data;
}])
<script src="http://ift.tt/1mQ03rn"></script>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="test">
<meta name="author" content="">
<title>Page Title</title>
</head>
<body ng-app="demo" ng-controller="ctrl">
<h1>Body</h1>
<input type="checkbox" ng-model="obj.C_DJB.VAL" ng-true-value="1" ng-false-value="0" ng-checked="obj.C_DJB.VAL=='1'" /> <br/>
<input type="checkbox" ng-model="obj.C_DJB.VAL" ng-true-value="1" ng-false-value="0" ng-checked="obj.C_DJB.VAL=='1'" /> <br/>
</body>
</html>
Aucun commentaire:
Enregistrer un commentaire