当Is Boss? : true
具有布尔person.IsBoss
时,我有以下带有AJS的HTML,我希望看到true
。
<span>Is Boss? :</span> <span> {{ person.IsBoss }}</span>
但它会显示为
Is Boss? :
如何制作AJS显示&#34; true&#34;或&#34;假&#34;对于布尔值?
答案 0 :(得分:1)
您的代码应该可以正常工作,看看:
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>