ng-switch-when与ng-repeat一起使用时 [英] ng-switch-when with ng-repeat

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

问题描述

我的HTML代码是

<tr ng-switch-when="true" ng-repeat="onlineCredentials in onlineCredentialDetails" >
        <td>
            <span>Ordering Mode: </span>{{onlineCredentials.mode}}<br />
            <span>Intermedtiary Group: </span>{{onlineCredentials.name}}
        </td>
        <td>
            <span>Website: </span>{{onlineCredentials.webSite}}
        </td>
        <td >
            <span>Username / Password</span>
            <div ng-repeat="cred in onlineCredentials.loginDetails">
                -&nbsp;{{cred.userName}}&nbsp;/&nbsp;{{cred.password}}
            </div><br />
        </td>
    </tr>

没有绑定数据...(存在TD和文本,但绑定属性值为空)

Which is not binding data... (TD s and text is present but binding property values are empty)

如何同时使用ng-switch-when和ng-repeat?

How to work with ng-switch-when and ng-repeat at a time?

预先感谢

推荐答案

这是设计使然.请参阅 https://stackoverflow.com/a/15434085/1264360 .基本上,要修复此问题,您需要在ng-repeat上方的元素中具有ng-switch-.

This is by design. Please see https://stackoverflow.com/a/15434085/1264360. Basically to fix you need to have the ng-switch-when in an element above the ng-repeat.

这篇关于ng-switch-when与ng-repeat一起使用时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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