0

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?

1
  • Probably does not make a different but the input tag does not have a end tag. <input type="checkbox" /> Commented Mar 25, 2015 at 20:57

1 Answer 1

1

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>

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.