You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Turn md-card element to mdCard Directive to give other elements 'Card powers' #6739
changed the title [-]md-card as Directive to give other elements 'Card powers'[/-][+]Turn md-card element to mdCard Directive to give other elements 'Card powers'[/+]on Aug 30, 2017
Unfortunately its not possible to have md-card as a Directive because it uses a template.
Furthermore, if the templating were to be removed, styles cannot be applied via Directive selectors as shown in the documentation for the @Directive decorator.
If you are looking to provide the elevated look of the md-card, you should be able to do this using box-shadow on any components.
Elevation is not the only feature that a card provides... If I only wanted a <div> to look like a card, I could just use class mat-card. That is not the point.
All the elements (<md-card-header>, <md-card-title>, <md-card-content>, etc) lose all their appearance and behavior if there is no <md-card> element on top.
angular-automatic-lock-bot commented on Sep 7, 2019
Activity
[-]md-card as Directive to give other elements 'Card powers'[/-][+]Turn md-card element to mdCard Directive to give other elements 'Card powers'[/+]josephperrott commentedon Aug 30, 2017
Unfortunately its not possible to have
md-cardas a Directive because it uses a template.Furthermore, if the templating were to be removed, styles cannot be applied via Directive selectors as shown in the documentation for the
@Directivedecorator.If you are looking to provide the elevated look of the
md-card, you should be able to do this usingbox-shadowon any components.willshowell commentedon Aug 30, 2017
To supplement @josephperrott's answer, material provides a
mat-elevationmixin and helper classes for adding elevation to elements:See #3917 for in-progress guide
jagomf commentedon Sep 6, 2017
Elevation is not the only feature that a card provides... If I only wanted a
<div>to look like a card, I could just use classmat-card. That is not the point.All the elements (
<md-card-header>,<md-card-title>,<md-card-content>, etc) lose all their appearance and behavior if there is no<md-card>element on top.angular-automatic-lock-bot commentedon Sep 7, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.