AngularJS:ng-显示行为不同
AngularJS:ng-show behaving different
我正在试用 Angular JS 应用程序,我认为我的 ng-show 表现得很奇怪。
我在下面列出了代码的工作版本和不工作版本(作为图像)。
根据在线文档和示例,我期望“ng-show=displayList”,但它不起作用。知道为什么吗?
改成这样
$scope.displayList = false;
使其成为布尔值而不是字符串
而不是:
$scope.displayList = "false"
给予:
$scope.displayList = false
ng-show 需要布尔值,因此请按以下方式更改代码..
$scope.displayList = false
使用布尔值代替字符串 false 代替 "false"
我正在试用 Angular JS 应用程序,我认为我的 ng-show 表现得很奇怪。
我在下面列出了代码的工作版本和不工作版本(作为图像)。
根据在线文档和示例,我期望“ng-show=displayList”,但它不起作用。知道为什么吗?
改成这样
$scope.displayList = false;
使其成为布尔值而不是字符串
而不是:
$scope.displayList = "false"
给予:
$scope.displayList = false
ng-show 需要布尔值,因此请按以下方式更改代码..
$scope.displayList = false
使用布尔值代替字符串 false 代替 "false"