Skip to content

Answer:16 dependency injection#1525

Open
phhien203 wants to merge 1 commit into
tomalaforge:mainfrom
phhien203:phhien203-di
Open

Answer:16 dependency injection#1525
phhien203 wants to merge 1 commit into
tomalaforge:mainfrom
phhien203:phhien203-di

Conversation

@phhien203

@phhien203 phhien203 commented Jun 23, 2026

Copy link
Copy Markdown

✅ Challenge Submission Checklist

Start your PR title with: Answer:${challenge_number}

⚠️ Important Notice

If you would like personal feedback or a detailed review, please support the project on GitHub:

You can also submit a PR without sponsorship to:

  • Be listed among the answered challenges, or
  • Receive a review from a community member. 🔥

Summary by CodeRabbit

  • New Features

    • Product rows now use their own currency configuration, so each row can display amounts using the correct currency.
    • The shared table now supports template outlet rendering, improving flexibility for projected content.
  • Bug Fixes

    • Fixed missing Angular imports needed for row-level binding and template rendering, preventing display issues in the product table.

@github-actions github-actions Bot added 16 dependancy injection answer answer sponsor sponsor the project to be reviewed PR requests a review labels Jun 23, 2026
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9b00f895-f8f2-42d5-9875-6b4fa3a2d1e8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/angular/16-master-dependency-injection/src/app/app.component.ts`:
- Around line 32-33: The row directive selector in AppComponent does not follow
the Angular ESLint directive-selector convention, so update the `@Directive`
selector from the current attribute name to an app-prefixed one and keep the
template usage in sync. Fix the selector on the directive class in
app.component.ts (the directive that handles currency code rows) and update the
matching binding wherever it is used in the template so the selector and markup
stay aligned; if the selector must remain unchanged, add a local lint disable
instead.
- Around line 40-42: The unused private EffectRef field in AppComponent should
be removed because it is only created and never read or destroyed. Update the
effect setup in the app component so the sync logic still runs via effect(() =>
...) but do not assign it to `#syncCodeEffectRef`, and keep the patchState call in
the effect body unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2428df75-fe66-420a-b5a1-9d2456b3e53b

📥 Commits

Reviewing files that changed from the base of the PR and between 543770b and 4c2c8be.

📒 Files selected for processing (2)
  • apps/angular/16-master-dependency-injection/src/app/app.component.ts
  • libs/shared/ui/src/lib/table.component.ts

Comment on lines +32 to +33
@Directive({
selector: 'tr[currencyCode]',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== File outline ==\n'
ast-grep outline apps/angular/16-master-dependency-injection/src/app/app.component.ts --view expanded || true

printf '\n== Relevant file excerpt ==\n'
cat -n apps/angular/16-master-dependency-injection/src/app/app.component.ts | sed -n '1,140p'

printf '\n== Search for directive selector lint config ==\n'
rg -n "`@angular-eslint/directive-selector`|directive-selector" -S . --glob '!**/node_modules/**' --glob '!**/dist/**' || true

printf '\n== Search for inline disables near the directive ==\n'
rg -n "eslint-disable|directive-selector|currencyCode" apps/angular/16-master-dependency-injection/src/app/app.component.ts -n -S || true

Repository: tomalaforge/angular-challenges

Length of output: 11889


🏁 Script executed:

#!/bin/bash
set -euo pipefail

cat -n apps/angular/16-master-dependency-injection/eslint.config.mjs

Repository: tomalaforge/angular-challenges

Length of output: 1098


Prefix the row directive selector to match the lint rule.
@angular-eslint/directive-selector here requires an app-prefixed attribute selector, so tr[currencyCode] will fail lint. Rename it to something like tr[appCurrencyCode] and update the template binding at line 66, or add a local disable if this exact selector is intentional.

🧰 Tools
🪛 ESLint

[error] 33-33: The selector should start with one of these prefixes: "app"

(@angular-eslint/directive-selector)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/angular/16-master-dependency-injection/src/app/app.component.ts` around
lines 32 - 33, The row directive selector in AppComponent does not follow the
Angular ESLint directive-selector convention, so update the `@Directive` selector
from the current attribute name to an app-prefixed one and keep the template
usage in sync. Fix the selector on the directive class in app.component.ts (the
directive that handles currency code rows) and update the matching binding
wherever it is used in the template so the selector and markup stay aligned; if
the selector must remain unchanged, add a local lint disable instead.

Source: Linters/SAST tools

Comment on lines +40 to +42
#syncCodeEffectRef = effect(() => {
this.#currencyService.patchState({ code: this.currencyCode() });
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

git ls-files apps/angular/16-master-dependency-injection/src/app/app.component.ts && printf '\n---\n' && cat -n apps/angular/16-master-dependency-injection/src/app/app.component.ts

Repository: tomalaforge/angular-challenges

Length of output: 2772


🏁 Script executed:

rg -n "no-unused-private-class-members|EffectRef|effect\(" apps/angular/16-master-dependency-injection/src/app -S

Repository: tomalaforge/angular-challenges

Length of output: 278


Drop the unused EffectRef field. #syncCodeEffectRef is never read or destroyed, so it just trips no-unused-private-class-members. If you only need the side effect, create the effect without storing the ref.

🧰 Tools
🪛 ESLint

[error] 40-40: '#syncCodeEffectRef' is defined but never used.

(no-unused-private-class-members)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/angular/16-master-dependency-injection/src/app/app.component.ts` around
lines 40 - 42, The unused private EffectRef field in AppComponent should be
removed because it is only created and never read or destroyed. Update the
effect setup in the app component so the sync logic still runs via effect(() =>
...) but do not assign it to `#syncCodeEffectRef`, and keep the patchState call in
the effect body unchanged.

Source: Linters/SAST tools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

16 dependancy injection answer answer sponsor sponsor the project to be reviewed PR requests a review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant