- Angular Material 教程
- Angular Material - 主页
- Angular Material - 概览
- 环境设置
- Angular Material - 自动完成
- Angular Material - 底部表
- Angular Material - 卡片
- Angular Material - Widget
- Angular Material - 布局
- Angular Material - 输入
- Angular Material - 图标
- Angular Material - 表格
- Angular Material - 侧边栏
- Angular Material - 浮动操作按钮速度拨号
- Angular Material - 子标题
- Angular Material - 滑动
- Angular Material - 开关
- Angular Material - 主题
- Angular Material - 弹出
- Angular Material - 版式
- Angular Material - 虚拟重复
- Angular Material - 白框
- Angular Material 实用资源
- Angular Material - 快速指南
- Angular Material - 实用资源
- Angular Material - 讨论
Angular Material - 选项
用于显示由 ng-model 限定的选择框的 Angular 指令 md-select。
属性 - md-radio-group
下表列出了 md-radio-group 的不同属性的参数和描述。
序号 | 参数和描述 |
---|---|
1 | * ng-model 模型! |
2 | multiple 是否为多选。 |
3 | md-on-close 选择关闭时要评估的表达式。 |
4 | placeholder 占位符提示文本。 |
5 | baria-label
辅助功能的可选标签。仅当不存在占位符或明确标签时才需要。 |
6 | md-container-class 要应用于 .md-select-menu-container 元素的类列表(用于自定义样式)。 |
示例
以下示例展示了 md-select
展示选择框用法的示例。
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>
结果
验证结果。
angular_material_widgets.htm
广告