Card

API for card

API reference for Angular Material card

import {MatCardModule} from '@angular/material/card';

A basic content container component that adds the styles of a Material design card.

While this component can be used alone, it also provides a number of preset styles for common card sections, including:

  • mat-card-title
  • mat-card-subtitle
  • mat-card-content
  • mat-card-actions
  • mat-card-footer

Selector: mat-card

Exported as: matCard

API reference for Angular Material card-testing

import {MatCardHarness} from '@angular/material/card/testing';

Harness for interacting with a standard mat-card in tests.

Methods
async
getAllChildLoaders
Parameters

selector

S

Returns
Promise<HarnessLoader[]>

async
getAllHarnesses
Parameters

query

HarnessQuery<T>

Returns
Promise<T[]>

async
getChildLoader
Parameters

selector

S

Returns
Promise<HarnessLoader>

async
getHarness
Parameters

query

HarnessQuery<T>

Returns
Promise<T>

async
getSubtitleText

Gets the cards's subtitle text.

Returns
Promise<string>

async
getText

Gets all of the card's content as text.

Returns
Promise<string>

async
getTitleText

Gets the cards's title text.

Returns
Promise<string>

async
host

Gets a Promise for the TestElement representing the host element of the component.

Returns
Promise<TestElement>

A set of criteria that can be used to filter a list of MatCardHarness instances.

Properties
Name Description

subtitle: string | RegExp

Only find instances whose subtitle matches the given value.

text: string | RegExp

Only find instances whose text matches the given value.

title: string | RegExp

Only find instances whose title matches the given value.