angularjs – 在选择选项中显示两个属性组合
发布时间:2020-12-17 17:20:14 所属栏目:安全 来源:网络整理
导读:以下是我的选择框 select ng-model="colour" ng-options="c.id as c.name for c in colors" ng-init="colour=2" option value=""--Select Colour--/option/select 以下是控制器中的代码 $scope.colors = [ {id: 1,name: 'black',shade: 'dark'},{id: 2,name:
以下是我的选择框
<select ng-model="colour" ng-options="c.id as c.name for c in colors" ng-init="colour=2"> <option value="">--Select Colour--</option> </select> 以下是控制器中的代码 $scope.colors = [ {id: 1,name: 'black',shade: 'dark'},{id: 2,name: 'white',shade: 'light'},{id: 3,name: 'red',{id: 4,name: 'blue',{id: 5,name: 'yellow',shade: 'light'} ]; 在此选择中,仅显示颜色的名称,我的要求是在选项文本中显示名称和阴影.我试过但没有运气,也没有找到任何有用的帖子来做到这一点. 任何人都有一些想法在选择选项文本(编辑,黑暗)中显示名称和阴影. 解决方法
您可以将阴影附加到表达式中的名称:
ng-options="c.id as (c.name + ' ' + c.shade) for c in colors" Fiddle (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- shell里的getopts
- 将bootstrap按钮类添加到rails 4中的button_to
- angularjs – 使用ng-required vs required
- 你应当定期更改密码吗?
- Shell脚本中‘‘ () {} [] " " [[]] ``的不同用法
- Angular2学习笔记(五) Angular2 表单
- unix – 如果EIO关闭(2)失败,文件描述符是否仍然被删除?
- 生成cscope和ctags文件供vim使用,cscope.files和tags文件中
- shell脚本数组报错Syntax error: "(" unexpected
- 在AngularJS中的控制器之间共享数据