- 教程
- 概述
- 环境设置(Environment Setup)
- 自动完成(Autocomplete)
- 角材料 - 底板(Bottom Sheet)
- Cards
- 小部件(Widgets)
- 布局(Layouts)
- 输入(Inputs)
- Icons
- Grids
- SideNav(SideNav)
- Fab 速拨号(Fab Speed Dial)
- 子头(Subheaders)
- Swipe
- 开关(Switches)
- 主题(Themes)
- 祝酒词(Toasts)
- 排版(Typography)
- 虚拟重复(Virtual Repeat)
- 白色框架(WhiteFrame)
- 有用的资源
- Buttons
- CheckBoxes
- Content
- DatePicker
- Dialogs
- Divider
- List
- Menu
- Menu Bar
- Progress Bars
- Radio Buttons
- Selects
- ListBox和ListCtrl(ListBox & ListCtrl)
- Sliders
- Tabs
- Toolbars
- Tooltips
- Chips
- Contact Chips
文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
Selects
md-select ,一个Angular指令用于显示选择框,由ng-model限定。
属性 - md-radio-group
下表列出了md-radio-group的不同属性的参数和描述。
Sr.No | 参数和描述 |
---|---|
1 | * ng-model 该模型! |
2 | multiple 是否是多重的。 |
3 | md-on-close 选择关闭时要评估的表达式。 |
4 | placeholder 占位符提示文本。 |
5 | baria-label 可访问性的可选标签。 仅在没有占位符或显式标签的情况下才有必要。 |
6 | md-container-class 要应用于.md-select-menu-container元素的类列表(用于自定义样式)。 |
例子 (Example)
以下示例展示了使用选择框的md-select showcase使用。
am_selects.htm
<html lang = "en">
<head>
<link rel = "stylesheet"
href = "https://ajax.googleapis.com/ajax/libs/angular_material/1.0.0/angular-material.min.css">
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-animate.min.js"></script>
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-aria.min.js"></script>
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-messages.min.js"></script>
<script src = "https://ajax.googleapis.com/ajax/libs/angular_material/1.0.0/angular-material.min.js"></script>
<link rel = "stylesheet" href = "https://fonts.googleapis.com/icon?family=Material+Icons">
<script language = "javascript">
angular
.module('firstApplication', ['ngMaterial'])
.controller('selectController', selectController);
function selectController ($scope) {
$scope.users = [
{ id: 1, name: 'Mahesh' },
{ id: 2, name: 'Ramesh' },
{ id: 3, name: 'Sohan' }
];
$scope.selectedUser = { id: 2, name: 'Ramesh' };
$scope.drinks = [
{ category: 'hard', name: 'Beer' },
{ category: 'hard', name: 'Rum' },
{ category: 'hard', name: 'Vodka' },
{ category: 'hard', name: 'Whiski' },
{ category: 'soft', name: 'Coke' },
{ category: 'soft', name: 'Pepsi' },
{ category: 'soft', name: 'Pulp Maid' },
{ category: 'soft', name: 'Real Juice' }
];
}
</script>
</head>
<body ng-app = "firstApplication">
<div id = "selectContainer" ng-controller = "selectController as ctrl"
layout = "row" ng-cloak>
<md-input-container>
<label>User</label>
<md-select ng-model = "selectedUser">
<md-option ng-value = "user"
ng-repeat = "user in users">{{ user.name }}</md-option>
</md-select>
</md-input-container>
<md-input-container>
<label>Drinks</label>
<md-select ng-model = "drink">
<md-optgroup label = "Hard Drinks">
<md-option ng-value = "drink.name"
ng-repeat = "drink in drinks | filter: {category: 'hard' }">
{{drink.name}}</md-option>
</md-optgroup>
<md-optgroup label = "Soft Drinks">
<md-option ng-value = "drink.name"
ng-repeat = "drink in drinks | filter: {category: 'soft' }">
{{drink.name}}</md-option>
</md-optgroup>
</md-select>
</md-input-container>
</div>
</body>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论