Skip to content

Commit 243b97d

Browse files
crisbetojelbourn
authored andcommitted
fix(card): unable to bind to align attribute (#5495)
Fixes not being able to bind to the `align` attribute on the `md-card-actions`. Fixes #5490.
1 parent d04230c commit 243b97d

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

src/lib/card/card.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ $mat-card-header-size: 40px !default;
4343
margin-left: -16px;
4444
margin-right: -16px;
4545
padding: 8px 0;
46+
}
4647

47-
&[align='end'] {
48-
display: flex;
49-
justify-content: flex-end;
50-
}
48+
.mat-card-actions-align-end {
49+
display: flex;
50+
justify-content: flex-end;
5151
}
5252

5353
.mat-card-image {

src/lib/card/card.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import {
1010
Component,
1111
ViewEncapsulation,
1212
ChangeDetectionStrategy,
13-
Directive
13+
Directive,
14+
Input,
1415
} from '@angular/core';
1516

1617

@@ -56,9 +57,15 @@ export class MdCardSubtitle {}
5657
*/
5758
@Directive({
5859
selector: 'md-card-actions, mat-card-actions',
59-
host: {'class': 'mat-card-actions'}
60+
host: {
61+
'class': 'mat-card-actions',
62+
'[class.mat-card-actions-align-end]': 'align === "end"',
63+
}
6064
})
61-
export class MdCardActions {}
65+
export class MdCardActions {
66+
/** Position of the actions inside the card. */
67+
@Input() align: 'start' | 'end' = 'start';
68+
}
6269

6370
/**
6471
* Footer of a card, needed as it's used as a selector in the API.

0 commit comments

Comments
 (0)