+ }
+ `,
+ changeDetection: ChangeDetectionStrategy.OnPush,
+ host: {
+ class: 'p-4 border border-grey rounded-sm flex flex-col w-[200px]',
+ },
+})
+export class CardComponent {
+ small = input(false);
+}
diff --git a/apps/angular/58-content-projection-condition/src/index.html b/apps/angular/58-content-projection-condition/src/index.html
new file mode 100644
index 0000000..f1768ec
--- /dev/null
+++ b/apps/angular/58-content-projection-condition/src/index.html
@@ -0,0 +1,13 @@
+
+
+
+
+ angular-content-projection-condition
+
+
+
+
+
+
+
+
diff --git a/apps/angular/58-content-projection-condition/src/main.ts b/apps/angular/58-content-projection-condition/src/main.ts
new file mode 100644
index 0000000..f3a7223
--- /dev/null
+++ b/apps/angular/58-content-projection-condition/src/main.ts
@@ -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),
+);
diff --git a/apps/angular/58-content-projection-condition/src/styles.scss b/apps/angular/58-content-projection-condition/src/styles.scss
new file mode 100644
index 0000000..77e408a
--- /dev/null
+++ b/apps/angular/58-content-projection-condition/src/styles.scss
@@ -0,0 +1,5 @@
+@tailwind base;
+@tailwind components;
+@tailwind utilities;
+
+/* You can add global styles to this file, and also import other style files */
diff --git a/apps/angular/58-content-projection-condition/tailwind.config.js b/apps/angular/58-content-projection-condition/tailwind.config.js
new file mode 100644
index 0000000..38183db
--- /dev/null
+++ b/apps/angular/58-content-projection-condition/tailwind.config.js
@@ -0,0 +1,14 @@
+const { createGlobPatternsForDependencies } = require('@nx/angular/tailwind');
+const { join } = require('path');
+
+/** @type {import('tailwindcss').Config} */
+module.exports = {
+ content: [
+ join(__dirname, 'src/**/!(*.stories|*.spec).{ts,html}'),
+ ...createGlobPatternsForDependencies(__dirname),
+ ],
+ theme: {
+ extend: {},
+ },
+ plugins: [],
+};
diff --git a/apps/angular/58-content-projection-condition/tsconfig.app.json b/apps/angular/58-content-projection-condition/tsconfig.app.json
new file mode 100644
index 0000000..5822042
--- /dev/null
+++ b/apps/angular/58-content-projection-condition/tsconfig.app.json
@@ -0,0 +1,10 @@
+{
+ "extends": "./tsconfig.json",
+ "compilerOptions": {
+ "outDir": "../../../dist/out-tsc",
+ "types": []
+ },
+ "files": ["src/main.ts"],
+ "include": ["src/**/*.d.ts"],
+ "exclude": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts"]
+}
diff --git a/apps/angular/58-content-projection-condition/tsconfig.editor.json b/apps/angular/58-content-projection-condition/tsconfig.editor.json
new file mode 100644
index 0000000..a8ac182
--- /dev/null
+++ b/apps/angular/58-content-projection-condition/tsconfig.editor.json
@@ -0,0 +1,6 @@
+{
+ "extends": "./tsconfig.json",
+ "include": ["src/**/*.ts"],
+ "compilerOptions": {},
+ "exclude": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts"]
+}
diff --git a/apps/angular/58-content-projection-condition/tsconfig.json b/apps/angular/58-content-projection-condition/tsconfig.json
new file mode 100644
index 0000000..1b86db0
--- /dev/null
+++ b/apps/angular/58-content-projection-condition/tsconfig.json
@@ -0,0 +1,29 @@
+{
+ "compilerOptions": {
+ "target": "es2022",
+ "esModuleInterop": true,
+ "forceConsistentCasingInFileNames": true,
+ "strict": true,
+ "noImplicitOverride": true,
+ "noPropertyAccessFromIndexSignature": true,
+ "noImplicitReturns": true,
+ "noFallthroughCasesInSwitch": true
+ },
+ "files": [],
+ "include": [],
+ "references": [
+ {
+ "path": "./tsconfig.editor.json"
+ },
+ {
+ "path": "./tsconfig.app.json"
+ }
+ ],
+ "extends": "../../../tsconfig.base.json",
+ "angularCompilerOptions": {
+ "enableI18nLegacyMessageIdFormat": false,
+ "strictInjectionParameters": true,
+ "strictInputAccessModifiers": true,
+ "strictTemplates": true
+ }
+}
diff --git a/challenge-number.json b/challenge-number.json
index de62178..4c221a9 100644
--- a/challenge-number.json
+++ b/challenge-number.json
@@ -1,6 +1,6 @@
{
- "total": 57,
+ "total": 58,
"🟢": 22,
- "🟠": 123,
+ "🟠": 124,
"🔴": 211
}
diff --git a/docs/src/content/docs/challenges/angular/57-content-projection-default.md b/docs/src/content/docs/challenges/angular/57-content-projection-default.md
index 59651c9..68bc945 100644
--- a/docs/src/content/docs/challenges/angular/57-content-projection-default.md
+++ b/docs/src/content/docs/challenges/angular/57-content-projection-default.md
@@ -8,7 +8,6 @@ challengeNumber: 57
command: angular-content-projection-default
sidebar:
order: 22
- badge: New
---
## Information
diff --git a/docs/src/content/docs/challenges/angular/58-content-projection-condition.md b/docs/src/content/docs/challenges/angular/58-content-projection-condition.md
new file mode 100644
index 0000000..10d1a9c
--- /dev/null
+++ b/docs/src/content/docs/challenges/angular/58-content-projection-condition.md
@@ -0,0 +1,39 @@
+---
+title: 🟠 Content Projection Condition
+description: Challenge 58 is about conditional content projection in Angular
+author: thomas-laforge
+contributors:
+ - tomalaforge
+challengeNumber: 58
+command: angular-content-projection-condition
+sidebar:
+ order: 124
+ badge: New
+---
+
+## Information
+
+Content projection in Angular allows you to create flexible and reusable components by dynamically inserting content from a parent component using ``. However, debugging content projection issues can sometimes be tricky.
+
+In this challenge, we have a `CardComponent` that supports a small mode, which conditionally changes how the projected content is displayed. However, there is a bug: when `small` is `false`, the card does not render properly.
+
+Your task is to identify and fix this issue without adding `inputs` while ensuring that the intended behavior remains unchanged.
+
+## Statement
+
+Your goal is to fix the issue where the `CardComponent` does not render when `small` is `false`.
+
+## Steps to complete:
+
+- Analyze how the `small` property is used inside the template.
+- Identify why the content is not displayed when `small` is `false`.
+- Modify the component to ensure that both cases (`small` = `true` and `small` = `false`) work as expected, while keeping the same structure and behavior.
+- Ensure that no new `input` properties are introduced in the component.
+
+## Constraints
+
+- You must not add any new `input` properties.
+- The expected UI and behavior must remain unchanged.
+- The `@if` directive must be correctly handled to ensure content projection works.
+- Do not introduce additional services or state management solutions.
+- The fix should be minimal and focused on resolving the rendering issue.
diff --git a/docs/src/content/docs/es/index.mdx b/docs/src/content/docs/es/index.mdx
index afa938a..07a5a6a 100644
--- a/docs/src/content/docs/es/index.mdx
+++ b/docs/src/content/docs/es/index.mdx
@@ -13,7 +13,7 @@ hero:
icon: right-arrow
variant: primary
- text: Ir al Desafío más reciente
- link: /es/challenges/angular/57-content-projection-default/
+ link: /es/challenges/angular/58-content-projection-condition/
icon: rocket
- text: Dar una estrella
link: https://github.com/tomalaforge/angular-challenges
@@ -26,8 +26,8 @@ import MyIcon from '../../../components/MyIcon.astro';
import SubscriptionForm from '../../../components/SubscriptionForm.astro';
-
- Este repositorio contiene 57 Desafíos relacionados con Angular, Nx, RxJS, Ngrx y Typescript.
+
+ Este repositorio contiene 58 Desafíos relacionados con Angular, Nx, RxJS, Ngrx y Typescript.
Estos desafíos se resuelven en torno a problemas de la vida real o características específicas para mejorar tus habilidades.
diff --git a/docs/src/content/docs/fr/index.mdx b/docs/src/content/docs/fr/index.mdx
index 50aced4..0a6a685 100644
--- a/docs/src/content/docs/fr/index.mdx
+++ b/docs/src/content/docs/fr/index.mdx
@@ -13,7 +13,7 @@ hero:
icon: right-arrow
variant: primary
- text: Aller au dernier Challenge
- link: /fr/challenges/angular/57-content-projection-default/
+ link: /fr/challenges/angular/58-content-projection-condition/
icon: rocket
- text: Donne une étoile
link: https://github.com/tomalaforge/angular-challenges
@@ -26,8 +26,8 @@ import MyIcon from '../../../components/MyIcon.astro';
import SubscriptionForm from '../../../components/SubscriptionForm.astro';
-
- Ce répertoire rassemble 57 Défis liés à Angular, Nx, RxJS, Ngrx et Typescript. Ces défis portent sur des problèmes réels ou des fonctionnalités spécifiques pour améliorer vos compétences.
+
+ Ce répertoire rassemble 58 Défis liés à Angular, Nx, RxJS, Ngrx et Typescript. Ces défis portent sur des problèmes réels ou des fonctionnalités spécifiques pour améliorer vos compétences.
diff --git a/docs/src/content/docs/index.mdx b/docs/src/content/docs/index.mdx
index ce23f2f..a985e1e 100644
--- a/docs/src/content/docs/index.mdx
+++ b/docs/src/content/docs/index.mdx
@@ -13,7 +13,7 @@ hero:
icon: right-arrow
variant: primary
- text: Go to the latest Challenge
- link: /challenges/angular/57-content-projection-default/
+ link: /challenges/angular/58-content-projection-condition/
icon: rocket
- text: Give a star
link: https://github.com/tomalaforge/angular-challenges
@@ -27,8 +27,8 @@ import MyIcon from '../../components/MyIcon.astro';
import SubscriptionForm from '../../components/SubscriptionForm.astro';
-
- This repository gathers 57 Challenges related to Angular, Nx, RxJS, Ngrx and Typescript.
+
+ This repository gathers 58 Challenges related to Angular, Nx, RxJS, Ngrx and Typescript.
These challenges resolve around real-life issues or specific features to elevate your skills.
diff --git a/docs/src/content/docs/pt/index.mdx b/docs/src/content/docs/pt/index.mdx
index a74c16c..682a0c4 100644
--- a/docs/src/content/docs/pt/index.mdx
+++ b/docs/src/content/docs/pt/index.mdx
@@ -13,7 +13,7 @@ hero:
icon: right-arrow
variant: primary
- text: Ir para o desafio mais recente
- link: /pt/challenges/angular/57-content-projection-default/
+ link: /pt/challenges/angular/58-content-projection-condition/
icon: rocket
- text: Dar uma estrela
link: https://github.com/tomalaforge/angular-challenges
@@ -26,8 +26,8 @@ import MyIcon from '../../../components/MyIcon.astro';
import SubscriptionForm from '../../../components/SubscriptionForm.astro';
-
- Este repositório possui 57 Desafios relacionados a Angular, Nx, RxJS,
+
+ Este repositório possui 58 Desafios relacionados a Angular, Nx, RxJS,
Ngrx e Typescript.
Esses desafios são voltados para problemas reais ou funcionalidades específicas afim de
melhorar suas habilidades.
diff --git a/docs/src/content/docs/ru/index.mdx b/docs/src/content/docs/ru/index.mdx
index e8cb5df..694af4d 100644
--- a/docs/src/content/docs/ru/index.mdx
+++ b/docs/src/content/docs/ru/index.mdx
@@ -13,7 +13,7 @@ hero:
icon: right-arrow
variant: primary
- text: Перейти к последней задаче
- link: /ru/challenges/angular/57-content-projection-default/
+ link: /ru/challenges/angular/58-content-projection-condition/
icon: rocket
- text: Добавить звезду
link: https://github.com/tomalaforge/angular-challenges