forked from tomalaforge/angular-challenges
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcard.component.ts
More file actions
35 lines (32 loc) · 971 Bytes
/
card.component.ts
File metadata and controls
35 lines (32 loc) · 971 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { NgTemplateOutlet } from '@angular/common';
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
@Component({
selector: 'app-card',
template: `
@if (small()) {
<ng-container *ngTemplateOutlet="title"></ng-container>
<ng-container *ngTemplateOutlet="message"></ng-container>
} @else {
<div class="p-4">
<div class="text-2xl">
<ng-container *ngTemplateOutlet="title"></ng-container>
</div>
<ng-container *ngTemplateOutlet="message"></ng-container>
</div>
}
<ng-template #title>
<ng-content select="[title]" />
</ng-template>
<ng-template #message>
<ng-content select="[message]" />
</ng-template>
`,
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
class: 'p-4 border border-grey rounded-sm flex flex-col w-[200px]',
},
imports: [NgTemplateOutlet],
})
export class CardComponent {
small = input<boolean>(false);
}