我制作并且angularJS选择菜单工作正常:
<select
name="s1"
id="s1"
multiple="multiple"
data-native-menu="false"
data-role="none"
ng-model="userlistSelect"
ng-options="u.userId as u.firstName for u in member.getList()">
</select>
我的控制器是:
$scope.member = items;
如何实现以下目标:如果firstName
不可用,则显示emailID
?
答案 0 :(得分:1)
当firstName为falsy时,您可以更改ng-options以显示emailID ...
ng-options="u.userId as (u.firstName || u.emailID) for u in member.getList()"