mirror of
https://github.com/Raghu-Ch/angular-challenges.git
synced 2026-02-11 21:33:02 -05:00
feat(): merge challenge 57
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
||||
import { CardComponent } from './card.component';
|
||||
|
||||
@Component({
|
||||
imports: [CardComponent],
|
||||
selector: 'app-root',
|
||||
template: `
|
||||
<app-card title="Titre 1" message="Message1" />
|
||||
<app-card title="Titre 2" />
|
||||
`,
|
||||
host: {
|
||||
class: 'p-4 block flex flex-col gap-1',
|
||||
},
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class AppComponent {}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
|
||||
|
||||
export const appConfig: ApplicationConfig = {
|
||||
providers: [provideZoneChangeDetection({ eventCoalescing: true })],
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-card',
|
||||
imports: [],
|
||||
template: `
|
||||
<div>{{ title() }}</div>
|
||||
@if (message()) {
|
||||
<div>{{ message() }}</div>
|
||||
} @else {
|
||||
<div>Aucun message</div>
|
||||
}
|
||||
`,
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
host: {
|
||||
class: 'p-4 border border-grey rounded-sm flex flex-col w-[200px]',
|
||||
},
|
||||
})
|
||||
export class CardComponent {
|
||||
title = input.required<string>();
|
||||
message = input<string | undefined>(undefined);
|
||||
}
|
||||
13
apps/angular/57-content-projection-default/src/index.html
Normal file
13
apps/angular/57-content-projection-default/src/index.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>angular-content-projection-default</title>
|
||||
<base href="/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
||||
</head>
|
||||
<body>
|
||||
<app-root></app-root>
|
||||
</body>
|
||||
</html>
|
||||
7
apps/angular/57-content-projection-default/src/main.ts
Normal file
7
apps/angular/57-content-projection-default/src/main.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { bootstrapApplication } from '@angular/platform-browser';
|
||||
import { AppComponent } from './app/app.component';
|
||||
import { appConfig } from './app/app.config';
|
||||
|
||||
bootstrapApplication(AppComponent, appConfig).catch((err) =>
|
||||
console.error(err),
|
||||
);
|
||||
@@ -0,0 +1,5 @@
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
/* You can add global styles to this file, and also import other style files */
|
||||
Reference in New Issue
Block a user