0

I have the following HTML with AJS where I expect to see Is Boss? : true, when person.IsBoss has boolean true.

<span>Is Boss? :</span> <span> {{ person.IsBoss }}</span>

But it will be displayed as just

Is Boss? :

How to make AJS display "true" or "false" for boolean values?

4
  • There's not enough information here to answer. As long as the conditions you stated are correct, true will be displayed. Check that the controller is loaded correctly and the person object is at the lowest level of the controller. Alternatively, inspect the angular scope with firebug in firefox to find where the value is populated. Commented Nov 6, 2014 at 19:22
  • 1
    jsfiddle.net/se8ousa9 Commented Nov 6, 2014 at 19:22
  • @CD.. post that as an answer with a brief explanation. sean717, It really is that simple. Commented Nov 6, 2014 at 19:25
  • Yeah..just double checked and the silly problem is that IsBoss is not the propery of person. @CD.. post your comment as answer and I will accept it. Commented Nov 6, 2014 at 19:33

1 Answer 1

1

Your code should work just fine, have a look:

var myApp = angular.module('myApp', []);

function MyCtrl($scope) {
  $scope.person = {
    isBoss: true
  };
}
<body ng-app>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>

  <div ng-controller="MyCtrl">
    <span>Is Boss? :</span>  <span> {{ person.isBoss }}</span>

  </div>
</body>

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.