我的 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">
- {{cred.userName}} / {{cred.password}}
</div><br />
</td>
</tr>
哪个不是绑定数据...(存在 TD 和文本,但绑定属性值为空)
如何同时使用 ng-switch-when 和 ng-repeat?
提前致谢
ng-switch 需要父级有一个
ng-switch on="variableName"
和孩子
ng-switch-when="stuff1"
ng-repeat 示例
<div ng-repeat="value in values" ng-switch on="value.color">
<div ng-switch-when='blue'>Blue</div>
<div ng-switch-when='green'>Green</div>
<div ng-switch-when='orange'>Orange</div>
</div>
您的 ng-repeat 集合可能如下所示:
$scope.values = {
one: {color: 'blue', worth: 2},
two: {color: 'green', worth: 3},
three: {color: 'orange', worth: 4},
}
http://plnkr.co/edit/YavzpaPUBaBQNA0pHMPN?p=preview http://plnkr.co/edit/YavzpaPUBaBQNA0pHMPN?p=preview
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)