gpt4 book ai didi

javascript - 如何在 angularjs 的 View 中使用 ng-if 值检查 null?

转载 作者:IT王子 更新时间:2023-10-29 03:03:33 24 4
gpt4 key购买 nike

我有这种情况

<div ng-repeat="test in current">
<div ng-if="test.view == null">
<i class="icon ion-checkmark"></i>
</div>
</div>

test.view== null 不起作用,既不检查 test.view 也不检查 test.view == ''

有什么想法吗?

谢谢

编辑:

在循环中,有时 test.view 的值有时为 NULL,如果我这样做的话:

<div ng-if="!test.view">1</div>
<div ng-if="test.view">2</div>

我只会看到1

最佳答案

你应该检查!test,这里是a fiddle showing that .

<span ng-if="!test">null</span>

关于javascript - 如何在 angularjs 的 View 中使用 ng-if 值检查 null?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23556092/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com