Angular Material - 卡片



md-card是一个 Angular 指令,它是一个容器指令,用于在 AngularJS 应用程序中绘制卡片。下表列出了 md-card 中使用的 Angular 指令和类。

序号 指令/类及描述
1

<md-card-header>

卡片的头部,包含头像、文本和方形图像。

2

<md-card-avatar>

卡片头像。

3

md-user-avatar

用户图像的类。

4

<md-icon>

图标指令。

5

<md-card-header-text>

包含卡片描述的元素。

6

md-title

卡片标题的类。

7

md-subhead

卡片副标题的类。

8

<img>

卡片的图像。

9

<md-card-title>

卡片内容标题。

10

<md-card-title-text>

卡片标题文本容器。

11

md-headline

卡片内容标题的类。

12

md-subhead

卡片内容副标题的类。

13

<md-card-title-media>

标题内的方形图像。

14

md-media-sm

小型图像的类。

15

md-media-md

中型图像的类。

16

md-media-lg

大型图像的类。

17

<md-card-content>

卡片内容。

18

md-media-xl

超大型图像的类。

19

<md-card-actions>

卡片操作。

20

<md-card-icon-actions>

图标操作。

示例

以下示例显示了 md-card 指令的使用以及卡片类的使用。

am_cards.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('cardController', cardController);

         function cardController ($scope) {            
         }  
      </script>      
   </head>
   
   <body ng-app = "firstApplication">  
      <md-card>
         <img ng-src = "/html5/images/html5-mini-logo.jpg" class = "md-card-image" alt = "Learn HTML5">
         <md-card-header>
            <md-card-avatar>
               <img class = "md-user-avatar" src = "/html5/images/html5-mini-logo.jpg">
            </md-card-avatar>
            
            <md-card-header-text>
               <span class = "md-title">HTML5</span>
               <span class = "md-subhead">Learn HTML5 @TutorialsPoint.com</span>
            </md-card-header-text>
         </md-card-header>
         
         <md-card-title>
            <md-card-title-text>
               <span class = "md-headline">HTML5</span>
            </md-card-title-text>
         </md-card-title>
         
         <md-card-actions layout = "row" layout-align = "start center">
            <md-button>Download</md-button>
            <md-button>Start</md-button>
            <md-card-icon-actions>
               <md-button class = "md-icon-button" aria-label = "icon">
                  <md-icon class = "material-icons">add</md-icon>
               </md-button>
            </md-card-icon-actions>
         </md-card-actions>
         
         <md-card-content>
            <p>HTML5 is the next major revision of the HTML standard superseding HTML 4.01,
            XHTML 1.0, and XHTML 1.1. HTML5 is a standard for structuring and presenting 
            content on the World Wide Web.</p>
            
            <p>HTML5 is a cooperation between the World Wide Web Consortium (W3C) and the
            Web Hypertext Application Technology Working Group (WHATWG).</p>
            
            </p>The new standard incorporates features like video playback and 
            drag-and-drop that have been previously dependent on third-party browser
            plug-ins such as Adobe Flash, Microsoft Silverlight, and Google Gears.</p>
         </md-card-content>
      </md-card>
   </body>
</html>

结果

验证结果。

广告