- 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 - Toast
- Angular Material - 版式
- Angular Material - 虚拟重复
- Angular Material - 白框
- Angular Material 实用资源
- Angular Material - 快速指南
- Angular Material - 实用资源
- Angular Material - 讨论
Angular Material - 子标题
md-subheader 是一个 Angular 指令,用于显示一个区域的子标题。
示例
以下示例显示了 md-subheader 的使用方式和子标题组件的使用方式。
am_subheaders.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('subheaderController', subheaderController); function subheaderController ($scope) { $scope.fruitNames = ['Apple', 'Banana', 'Orange']; $scope.vegNames = ['Carrot', 'Potato', 'Cabbage']; $scope.eateries = ['Milk', 'Bread']; } </script> </head> <body ng-app = "firstApplication"> <div id = "subheaderContainer" ng-controller = "subheaderController as ctrl" layout = "column" flex layout-fill ng-cloak> <md-toolbar md-scroll-shrink> <div class = "md-toolbar-tools">Items</div> </md-toolbar> <md-content style = "height: 600px;"> <section> <md-subheader class = "md-primary">Fruits</md-subheader> <md-list layout-padding> <md-list-item ng-repeat = "fruits in fruitNames"> <div> <p>{{fruits}}</p> </div> </md-list-item> </md-list> </section> <section> <md-subheader class = "md-warn">Vegetables</md-subheader> <md-list layout-padding> <md-list-item ng-repeat = "veg in vegNames"> <div> <p>{{veg}}</p> </div> </md-list-item> </md-list> </section> <section> <md-subheader>Eateries</md-subheader> <md-list layout-padding> <md-list-item ng-repeat = "eatery in eateries"> <div> <p>{{eatery}}</p> </div> </md-list-item> </md-list> </section> </md-content> </div> </body> </html>
结果
验证结果。
广告