AngularJS:NG-开关时使用OR [英] AngularJS: ng-switch-when with an OR

查看:107
本文介绍了AngularJS:NG-开关时使用OR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能有一个或NG-开关时?

Is it possible to have an OR in ng-switch-when?

<div ng-repeat="w in windows" ng-show="visibleWindowId == w.id" ng-switch="w.type">
    <div ng-switch-when="val1 **OR** val2">
        sup
    </div>
</div>

如果没有,怎么可以在上面实现呢?

If not, how could the above be accomplished?

感谢:)

推荐答案

ngswitch 只允许您比较单一的状况。

ngswitch only allows you to compare a single condition.

我你正在寻找测试可以使用 NG-如果可用的version 1.1.5

I you are looking to test multiple conditions you can use ng-if available with version 1.1.5

参考

重要的是要注意的是,使用 NG-如果 NG-开关remove从DOM结构的元素,而不是显示和隐藏。

It is important to note that using ng-if and ng-switch remove the element from the DOM structure, opposed to show and hide.

这个时候你遍历DOM找到的元素是很重要的。

这篇关于AngularJS:NG-开关时使用OR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆