I am trying to set checkbox default ng-checked true. This is working but the problem is submitting after value not appearing.
This is my html markup
<html ng-app="plunker" >
<head>
<meta charset="utf-8">
<title>AngularJS Plunker</title>
<script>document.write('<base href="' + document.location + '" />');</script>
<link rel="stylesheet" href="style.css">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.js"></script>
<script src="app.js"></script>
</head>
<body ng-controller="MainCtrl">
<label><input type="checkbox" name="test1" ng-model="input.item1" ng-checked="true"/> Testing</label><br />
<input type="button" ng-click="submit(input)" value="Submit" />
</body>
</html>
Scripting app file is
var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
$scope.name = 'World';
$scope.input = {};
$scope.submit = function (data) {
alert(data.item1);
console.log($scope.input);
};
});
plunker link is http://plnkr.co/edit/mwdQF6Qqd4yw6hvLHGd6?p=preview
How to default and directly reviving checkbox value.
Thank you.