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..1de883e4e 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 @@ -1,16 +1,30 @@ -import { ChangeDetectionStrategy, Component } from '@angular/core'; +import { + ChangeDetectionStrategy, + Component, + CUSTOM_ELEMENTS_SCHEMA, + signal, +} from '@angular/core'; import { CardComponent } from './card.component'; @Component({ imports: [CardComponent], selector: 'app-root', template: ` - - + + {{ title1() }} + Message1 + + + {{ title2() }} + `, host: { class: 'p-4 block flex flex-col gap-1', }, + schemas: [CUSTOM_ELEMENTS_SCHEMA], changeDetection: ChangeDetectionStrategy.OnPush, }) -export class AppComponent {} +export class AppComponent { + title1 = signal('Titre 1'); + title2 = signal('Titre 2'); +} 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..20db0925b 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,16 @@ -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 {}