From b6f97b7d4c166decebda1492f24db668705c837a Mon Sep 17 00:00:00 2001 From: Mimo-07 <59221049+Mimo-07@users.noreply.github.com> Date: Fri, 25 Jul 2025 23:56:57 +0000 Subject: [PATCH] feat(57-content-projection): implement content projection --- .../src/app/app.component.ts | 9 +++++++-- .../src/app/card.component.ts | 15 +++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/apps/angular/57-content-projection-default/src/app/app.component.ts b/apps/angular/57-content-projection-default/src/app/app.component.ts index b3e370a34..8d7d49ff0 100644 --- a/apps/angular/57-content-projection-default/src/app/app.component.ts +++ b/apps/angular/57-content-projection-default/src/app/app.component.ts @@ -5,8 +5,13 @@ import { CardComponent } from './card.component'; imports: [CardComponent], selector: 'app-root', template: ` - - + +
Titre 1
+
Message1
+
+ +
Titre 2
+
`, host: { class: 'p-4 block flex flex-col gap-1', diff --git a/apps/angular/57-content-projection-default/src/app/card.component.ts b/apps/angular/57-content-projection-default/src/app/card.component.ts index 851a6619d..5d090c437 100644 --- a/apps/angular/57-content-projection-default/src/app/card.component.ts +++ b/apps/angular/57-content-projection-default/src/app/card.component.ts @@ -1,22 +1,17 @@ -import { ChangeDetectionStrategy, Component, input } from '@angular/core'; +import { ChangeDetectionStrategy, Component } from '@angular/core'; @Component({ selector: 'app-card', imports: [], template: ` -
{{ title() }}
- @if (message()) { -
{{ message() }}
- } @else { + +
Aucun message
- } +
`, changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'p-4 border border-grey rounded-sm flex flex-col w-[200px]', }, }) -export class CardComponent { - title = input.required(); - message = input(undefined); -} +export class CardComponent {}