我如何使用纳克开关,满足多种,同等条件? [英] How can I use ng-switch to satisfy multiple, same conditions?

查看:110
本文介绍了我如何使用纳克开关,满足多种,同等条件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个AngularJS一段HTML的基础上的认证状态。

I want to create a piece of HTML with AngularJS based on the authentication status.

我用 NG-开关

问题是,我想有一个条件多命中,但只AngularJS的satifies最后一个条件得到满足。

The issue is that I want to have multiple hits on a single condition, but AngularJS only satifies the last condition met.

该HTML听很接近,因为Bootrap用流利的布局。在 span3 span9 必须是直接跌破排液容器div,否则将无法很好地浮动。所以我不能引入额外的 NG-开关 div的吧...

The HTML listens very close, because of Bootrap with fluent layout. The span3 and span9 must be directly below row-fluid container div, otherwise it will not float nicely. So I cannot introduce extra ng-switch divs to it...

<div class="row-fluid" ng-switch on="user.isAuthenticated">
<div class="span3" ng-switch-when="true"><div>
<div class="span9 spade-contentwrapper" ng-switch-when="true"><div>
<div class="spade-contentwrapper" ng-switch-when="false"><div>
<div>

请参阅我的简化小提琴

推荐答案

角1.1.5支持 NG-如果。你可以看一下。然后你就可以拥有独立的条件。

Angular 1.1.5 supports ng-if. You can look at that. Then you can have independent conditions.

这篇关于我如何使用纳克开关,满足多种,同等条件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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