diff --git a/README.md b/README.md
index cf80d7b..4a2ec98 100644
--- a/README.md
+++ b/README.md
@@ -47,6 +47,7 @@ If you would like to propose a challenge, this project is open source, so feel f
+
@@ -94,7 +95,7 @@ If you would like to propose a challenge, this project is open source, so feel f
diff --git a/apps/bug-cd/.eslintrc.json b/apps/bug-cd/.eslintrc.json
new file mode 100644
index 0000000..b428c22
--- /dev/null
+++ b/apps/bug-cd/.eslintrc.json
@@ -0,0 +1,36 @@
+{
+ "extends": ["../../.eslintrc.json"],
+ "ignorePatterns": ["!**/*"],
+ "overrides": [
+ {
+ "files": ["*.ts"],
+ "rules": {
+ "@angular-eslint/directive-selector": [
+ "error",
+ {
+ "type": "attribute",
+ "prefix": "app",
+ "style": "camelCase"
+ }
+ ],
+ "@angular-eslint/component-selector": [
+ "error",
+ {
+ "type": "element",
+ "prefix": "app",
+ "style": "kebab-case"
+ }
+ ]
+ },
+ "extends": [
+ "plugin:@nx/angular",
+ "plugin:@angular-eslint/template/process-inline-templates"
+ ]
+ },
+ {
+ "files": ["*.html"],
+ "extends": ["plugin:@nx/angular-template"],
+ "rules": {}
+ }
+ ]
+}
diff --git a/apps/bug-cd/README.md b/apps/bug-cd/README.md
new file mode 100644
index 0000000..a1cdfbc
--- /dev/null
+++ b/apps/bug-cd/README.md
@@ -0,0 +1,38 @@
+Bug Change Detection
+
+> Author: Thomas Laforge
+
+This challenge is inspired by a real-life example that I simplified to create this nice challenge.
+
+### Information
+
+In this small application, we have a navigation menu to route our application to either `barComponent` or `FooComponent`. However our application is not loading and no errors are displayed inside the console.
+
+### Statement
+
+The goal of the challenge is to debug this application and make it work.
+
+#### Hint 1
+
+If you comment out `routerLinkActive="isSelected"` inside `NavigationComponent`: the application loads correctly.
+
+#### Hint 2
+
+If you open the [`RouterLinkActive` source code](https://github.com/angular/angular/blob/main/packages/router/src/directives/router_link_active.ts) and go to **line 196**, Angular is calling `this.cdr.markForCheck` inside a microTask which triggers a new CD cycle. If you comment out this line, the application loads again, however the bug is not inside the Angular Framework. 😅😯
+
+### Submitting your work
+
+1. Fork the project
+2. clone it
+3. npm ci
+4. `npx nx serve bug-cd`
+5. _...work on it_
+6. Commit your work
+7. Submit a PR with a title beginning with **Answer:32** that I will review and other dev can review.
+
+
+
+
+
+
+_You can ask any question on_
diff --git a/apps/bug-cd/jest.config.ts b/apps/bug-cd/jest.config.ts
new file mode 100644
index 0000000..01794b1
--- /dev/null
+++ b/apps/bug-cd/jest.config.ts
@@ -0,0 +1,22 @@
+/* eslint-disable */
+export default {
+ displayName: 'bug-cd',
+ preset: '../../jest.preset.js',
+ setupFilesAfterEnv: ['/src/test-setup.ts'],
+ coverageDirectory: '../../coverage/apps/bug-cd',
+ transform: {
+ '^.+\\.(ts|mjs|js|html)$': [
+ 'jest-preset-angular',
+ {
+ tsconfig: '/tsconfig.spec.json',
+ stringifyContentPathRegex: '\\.(html|svg)$',
+ },
+ ],
+ },
+ transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
+ snapshotSerializers: [
+ 'jest-preset-angular/build/serializers/no-ng-attributes',
+ 'jest-preset-angular/build/serializers/ng-snapshot',
+ 'jest-preset-angular/build/serializers/html-comment',
+ ],
+};
diff --git a/apps/bug-cd/project.json b/apps/bug-cd/project.json
new file mode 100644
index 0000000..d9f984c
--- /dev/null
+++ b/apps/bug-cd/project.json
@@ -0,0 +1,89 @@
+{
+ "name": "bug-cd",
+ "$schema": "../../node_modules/nx/schemas/project-schema.json",
+ "projectType": "application",
+ "prefix": "app",
+ "sourceRoot": "apps/bug-cd/src",
+ "tags": [],
+ "targets": {
+ "build": {
+ "executor": "@angular-devkit/build-angular:browser",
+ "outputs": ["{options.outputPath}"],
+ "options": {
+ "outputPath": "dist/apps/bug-cd",
+ "index": "apps/bug-cd/src/index.html",
+ "main": "apps/bug-cd/src/main.ts",
+ "polyfills": ["zone.js"],
+ "tsConfig": "apps/bug-cd/tsconfig.app.json",
+ "assets": ["apps/bug-cd/src/favicon.ico", "apps/bug-cd/src/assets"],
+ "styles": ["apps/bug-cd/src/styles.scss"],
+ "scripts": []
+ },
+ "configurations": {
+ "production": {
+ "budgets": [
+ {
+ "type": "initial",
+ "maximumWarning": "500kb",
+ "maximumError": "1mb"
+ },
+ {
+ "type": "anyComponentStyle",
+ "maximumWarning": "2kb",
+ "maximumError": "4kb"
+ }
+ ],
+ "outputHashing": "all"
+ },
+ "development": {
+ "buildOptimizer": false,
+ "optimization": false,
+ "vendorChunk": true,
+ "extractLicenses": false,
+ "sourceMap": true,
+ "namedChunks": true
+ }
+ },
+ "defaultConfiguration": "production"
+ },
+ "serve": {
+ "executor": "@angular-devkit/build-angular:dev-server",
+ "configurations": {
+ "production": {
+ "browserTarget": "bug-cd:build:production"
+ },
+ "development": {
+ "browserTarget": "bug-cd:build:development"
+ }
+ },
+ "defaultConfiguration": "development"
+ },
+ "extract-i18n": {
+ "executor": "@angular-devkit/build-angular:extract-i18n",
+ "options": {
+ "browserTarget": "bug-cd:build"
+ }
+ },
+ "lint": {
+ "executor": "@nx/linter:eslint",
+ "outputs": ["{options.outputFile}"],
+ "options": {
+ "lintFilePatterns": ["apps/bug-cd/**/*.ts", "apps/bug-cd/**/*.html"]
+ }
+ },
+ "test": {
+ "executor": "@nx/jest:jest",
+ "outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
+ "options": {
+ "jestConfig": "apps/bug-cd/jest.config.ts",
+ "passWithNoTests": true
+ },
+ "configurations": {
+ "ci": {
+ "ci": true,
+ "codeCoverage": true
+ }
+ }
+ }
+ }
+}
diff --git a/apps/bug-cd/src/app/app.component.ts b/apps/bug-cd/src/app/app.component.ts
new file mode 100644
index 0000000..3b45baa
--- /dev/null
+++ b/apps/bug-cd/src/app/app.component.ts
@@ -0,0 +1,21 @@
+import { Component } from '@angular/core';
+import { RouterOutlet } from '@angular/router';
+
+@Component({
+ standalone: true,
+ imports: [RouterOutlet],
+ selector: 'app-root',
+ template: `
+ My Application
+
+ `,
+ host: {
+ class: 'flex flex-col gap-2',
+ },
+})
+export class AppComponent {}
diff --git a/apps/bug-cd/src/app/app.config.ts b/apps/bug-cd/src/app/app.config.ts
new file mode 100644
index 0000000..0071d5c
--- /dev/null
+++ b/apps/bug-cd/src/app/app.config.ts
@@ -0,0 +1,30 @@
+import { ApplicationConfig } from '@angular/core';
+import { provideRouter } from '@angular/router';
+import { BarComponent } from './bar.component';
+import { FooComponent } from './foo.component';
+import { MainNavigationComponent } from './main-navigation.component';
+
+export const appConfig: ApplicationConfig = {
+ providers: [
+ provideRouter([
+ {
+ path: '',
+ component: MainNavigationComponent,
+ outlet: 'side',
+ },
+ {
+ path: '',
+ pathMatch: 'full',
+ redirectTo: 'foo',
+ },
+ {
+ path: 'foo',
+ component: FooComponent,
+ },
+ {
+ path: 'bar',
+ component: BarComponent,
+ },
+ ]),
+ ],
+};
diff --git a/apps/bug-cd/src/app/bar.component.ts b/apps/bug-cd/src/app/bar.component.ts
new file mode 100644
index 0000000..26eef1e
--- /dev/null
+++ b/apps/bug-cd/src/app/bar.component.ts
@@ -0,0 +1,7 @@
+import { Component } from '@angular/core';
+@Component({
+ selector: 'app-bar',
+ standalone: true,
+ template: ` BarComponent `,
+})
+export class BarComponent {}
diff --git a/apps/bug-cd/src/app/fake.service.ts b/apps/bug-cd/src/app/fake.service.ts
new file mode 100644
index 0000000..7640edf
--- /dev/null
+++ b/apps/bug-cd/src/app/fake.service.ts
@@ -0,0 +1,7 @@
+import { Injectable } from '@angular/core';
+import { delay, of } from 'rxjs';
+
+@Injectable({ providedIn: 'root' })
+export class FakeServiceService {
+ getInfoFromBackend = () => of('Client app').pipe(delay(500));
+}
diff --git a/apps/bug-cd/src/app/foo.component.ts b/apps/bug-cd/src/app/foo.component.ts
new file mode 100644
index 0000000..8006ecb
--- /dev/null
+++ b/apps/bug-cd/src/app/foo.component.ts
@@ -0,0 +1,7 @@
+import { Component } from '@angular/core';
+@Component({
+ selector: 'app-foo',
+ standalone: true,
+ template: `Foo Component `,
+})
+export class FooComponent {}
diff --git a/apps/bug-cd/src/app/main-navigation.component.ts b/apps/bug-cd/src/app/main-navigation.component.ts
new file mode 100644
index 0000000..c30281a
--- /dev/null
+++ b/apps/bug-cd/src/app/main-navigation.component.ts
@@ -0,0 +1,67 @@
+import { AsyncPipe, NgFor, NgIf } from '@angular/common';
+import { Component, Input, inject } from '@angular/core';
+import { RouterLink, RouterLinkActive } from '@angular/router';
+import { FakeServiceService } from './fake.service';
+
+interface MenuItem {
+ path: string;
+ name: string;
+}
+
+@Component({
+ selector: 'app-nav',
+ standalone: true,
+ imports: [RouterLink, RouterLinkActive, NgFor],
+ template: `
+
+
+ {{ menu.name }}
+
+
+ `,
+ styles: [
+ `
+ a.isSelected {
+ @apply bg-gray-600 text-white;
+ }
+ `,
+ ],
+ host: {
+ class: 'flex flex-col p-2 gap-2',
+ },
+})
+export class NavigationComponent {
+ @Input() menus!: MenuItem[];
+}
+
+@Component({
+ standalone: true,
+ imports: [NavigationComponent, NgIf, AsyncPipe],
+ template: `
+
+
+
+
+
+
+
+
+
+ `,
+ host: {},
+})
+export class MainNavigationComponent {
+ private fakeBackend = inject(FakeServiceService);
+
+ readonly info$ = this.fakeBackend.getInfoFromBackend();
+
+ getMenu(prop: string) {
+ return [
+ { path: '/foo', name: `Foo ${prop}` },
+ { path: '/bar', name: `Bar ${prop}` },
+ ];
+ }
+}
diff --git a/apps/bug-cd/src/assets/.gitkeep b/apps/bug-cd/src/assets/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/apps/bug-cd/src/favicon.ico b/apps/bug-cd/src/favicon.ico
new file mode 100644
index 0000000..317ebcb
Binary files /dev/null and b/apps/bug-cd/src/favicon.ico differ
diff --git a/apps/bug-cd/src/index.html b/apps/bug-cd/src/index.html
new file mode 100644
index 0000000..c05f415
--- /dev/null
+++ b/apps/bug-cd/src/index.html
@@ -0,0 +1,13 @@
+
+
+
+
+ test
+
+
+
+
+
+
+
+
diff --git a/apps/bug-cd/src/main.ts b/apps/bug-cd/src/main.ts
new file mode 100644
index 0000000..514c89a
--- /dev/null
+++ b/apps/bug-cd/src/main.ts
@@ -0,0 +1,7 @@
+import { bootstrapApplication } from '@angular/platform-browser';
+import { appConfig } from './app/app.config';
+import { AppComponent } from './app/app.component';
+
+bootstrapApplication(AppComponent, appConfig).catch((err) =>
+ console.error(err)
+);
diff --git a/apps/bug-cd/src/styles.scss b/apps/bug-cd/src/styles.scss
new file mode 100644
index 0000000..77e408a
--- /dev/null
+++ b/apps/bug-cd/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/bug-cd/src/test-setup.ts b/apps/bug-cd/src/test-setup.ts
new file mode 100644
index 0000000..15de72a
--- /dev/null
+++ b/apps/bug-cd/src/test-setup.ts
@@ -0,0 +1,2 @@
+import '@testing-library/jest-dom';
+import 'jest-preset-angular/setup-jest';
diff --git a/apps/bug-cd/tailwind.config.js b/apps/bug-cd/tailwind.config.js
new file mode 100644
index 0000000..38183db
--- /dev/null
+++ b/apps/bug-cd/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/bug-cd/tsconfig.app.json b/apps/bug-cd/tsconfig.app.json
new file mode 100644
index 0000000..fff4a41
--- /dev/null
+++ b/apps/bug-cd/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/bug-cd/tsconfig.editor.json b/apps/bug-cd/tsconfig.editor.json
new file mode 100644
index 0000000..8ae117d
--- /dev/null
+++ b/apps/bug-cd/tsconfig.editor.json
@@ -0,0 +1,7 @@
+{
+ "extends": "./tsconfig.json",
+ "include": ["src/**/*.ts"],
+ "compilerOptions": {
+ "types": ["jest", "node"]
+ }
+}
diff --git a/apps/bug-cd/tsconfig.json b/apps/bug-cd/tsconfig.json
new file mode 100644
index 0000000..e01cf19
--- /dev/null
+++ b/apps/bug-cd/tsconfig.json
@@ -0,0 +1,32 @@
+{
+ "compilerOptions": {
+ "target": "es2022",
+ "useDefineForClassFields": false,
+ "forceConsistentCasingInFileNames": true,
+ "strict": true,
+ "noImplicitOverride": true,
+ "noPropertyAccessFromIndexSignature": true,
+ "noImplicitReturns": true,
+ "noFallthroughCasesInSwitch": true
+ },
+ "files": [],
+ "include": [],
+ "references": [
+ {
+ "path": "./tsconfig.app.json"
+ },
+ {
+ "path": "./tsconfig.spec.json"
+ },
+ {
+ "path": "./tsconfig.editor.json"
+ }
+ ],
+ "extends": "../../tsconfig.base.json",
+ "angularCompilerOptions": {
+ "enableI18nLegacyMessageIdFormat": false,
+ "strictInjectionParameters": true,
+ "strictInputAccessModifiers": true,
+ "strictTemplates": true
+ }
+}
diff --git a/apps/bug-cd/tsconfig.spec.json b/apps/bug-cd/tsconfig.spec.json
new file mode 100644
index 0000000..1a4817a
--- /dev/null
+++ b/apps/bug-cd/tsconfig.spec.json
@@ -0,0 +1,15 @@
+{
+ "extends": "./tsconfig.json",
+ "compilerOptions": {
+ "outDir": "../../dist/out-tsc",
+ "module": "commonjs",
+ "types": ["jest", "node", "@testing-library/jest-dom"]
+ },
+ "files": ["src/test-setup.ts"],
+ "include": [
+ "jest.config.ts",
+ "src/**/*.test.ts",
+ "src/**/*.spec.ts",
+ "src/**/*.d.ts"
+ ]
+}