Reputation: 27
I tried the following code on angularjs 1.3.0 (ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular.min.js):-
<input type="checkbox" ng-model="chkboxmodel" ng-checked="true" ng-true-value="Blue" ng-false-value="Red"></input> {{chkboxmodel}}
However, when i click on the checkbox, {{chkboxmodel}} does not return either Blue or Red.
however when I change Angularjs version to 1.2.0 I get Red or Blue.
any idea what i need to do?
Upvotes: 0
Views: 231
Reputation: 16498
Please see demo below
remove ng-checked="true"
from your input
angular.module('app', []).controller('homeCtrl', function($scope) {
$scope.chkboxmodel = "Blue";
})
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="app">
<div ng-controller="homeCtrl">
<input type="checkbox" ng-model="chkboxmodel" ng-true-value="Blue" ng-false-value="Red" />{{chkboxmodel}}
</div>
</div>
Upvotes: 1