【发布时间】:2019-12-05 09:38:46
【问题描述】:
我将响应数据分配给 $scope 但带有 ng-show 的 div 仍然隐藏。我是 angularjs 的菜鸟,怎么了??
else {
debugger;
$scope.exception = data.exception; //data arrives correctly
和html
<div class="error-text" ng-show="exception.code">
但它不起作用并且控制台上没有显示错误
【问题讨论】:
-
"ng-show" 需要布尔值,那么 exception.code 的值是什么?
-
它是一个字符串不评估它是否为空吗?
-
可以分享更多的js控制器代码吗?
-
@afccc ,这是正确的,
null将评估为假。问题出在其他地方。
标签: javascript html angularjs