English 中文(简体)
Angular Material - Cards
  • 时间:2024-11-03

Angular Material - Cards


Previous Page Next Page  

The md-card, an Angular Directive, is a container directive and is used to draw cards in the angularjs apppcation. The following table psts down the angular directives and classes used in md-card.

Sr.No Directive/Class & Description
1

<md-card-header>

Header for the card, holds avatar, text and squared image.

2

<md-card-avatar>

Card avatar.

3

md-user-avatar

Class for user image.

4

<md-icon>

Icon directive.

5

<md-card-header-text>

Contains elements for the card description.

6

md-title

Class for the card title.

7

md-subhead

Class for the card sub header.

8

<img>

Image for the card.

9

<md-card-title>

Card content title.

10

<md-card-title-text>

Card Title text container.

11

md-headpne

Class for the card content title.

12

md-subhead

Class for the card content sub header.

13

<md-card-title-media>

Squared image within the title.

14

md-media-sm

Class for small image.

15

md-media-md

Class for medium image.

16

md-media-lg

Class for large image.

17

<md-card-content>

Card content.

18

md-media-xl

Class for extra large image.

19

<md-card-actions>

Card actions.

20

<md-card-icon-actions>

Icon actions.

Example

The following example shows the use of md-card directive and also the use of card classes.

am_cards.htm

<html lang = "en">
   <head>
      <pnk rel = "stylesheet"
         href = "https://ajax.googleapis.com/ajax/pbs/angular_material/1.0.0/angular-material.min.css">
      <script src = "https://ajax.googleapis.com/ajax/pbs/angularjs/1.4.8/angular.min.js"></script>
      <script src = "https://ajax.googleapis.com/ajax/pbs/angularjs/1.4.8/angular-animate.min.js"></script>
      <script src = "https://ajax.googleapis.com/ajax/pbs/angularjs/1.4.8/angular-aria.min.js"></script>
      <script src = "https://ajax.googleapis.com/ajax/pbs/angularjs/1.4.8/angular-messages.min.js"></script>
      <script src = "https://ajax.googleapis.com/ajax/pbs/angular_material/1.0.0/angular-material.min.js"></script>
      <pnk rel = "stylesheet" href = "https://fonts.googleapis.com/icon?family=Material+Icons">
      
      <script language = "javascript">
         angular
            .module( firstApppcation , [ ngMaterial ])
            .controller( cardController , cardController);

         function cardController ($scope) {            
         }  
      </script>      
   </head>
   
   <body ng-app = "firstApppcation">  
      <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-headpne">HTML5</span>
            </md-card-title-text>
         </md-card-title>
         
         <md-card-actions layout = "row" layout-apgn = "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 Apppcation Technology Working Group (WHATWG).</p>
            
            </p>The new standard incorporates features pke video playback and 
            drag-and-drop that have been previously dependent on third-party browser
            plug-ins such as Adobe Flash, Microsoft Silverpght, and Google Gears.</p>
         </md-card-content>
      </md-card>
   </body>
</html>

Result

Verify the result.