Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request introduces the functionality to access and manage custom directives applied to host elements, including nested child components, within an Angular project. The purpose is to allow components like
AccordionComponent
andAccordionItemComponent
to detect and interact with theAccordionSelfDirective
applied on both the host element and its child components. This improves the flexibility of the component structure, allowing each level of nesting to have customized logic and behavior while accessing directives.Why is this change necessary?
Previously, there was limited access to directives applied to nested components, which hindered the ability to dynamically adjust behavior for each level of nesting. By providing access to directives in both parent and child components, the application can support more complex and nested component structures where each component can independently interact with its directives.
How does this change improve the project?
This change:
AccordionComponent
andAccordionItemComponent
based on the applied directives.Related Issue(s)
Changes
@ContentChildren
to query for theAccordionSelfDirective
in bothAccordionComponent
andAccordionItemComponent
.AccordionComponent
andAccordionItemComponent
to properly interact with the directives applied to both parent and nested child components.How to Test
To verify the changes:
AccordionComponent
andAccordionItemComponent
both include theAccordionSelfDirective
in their templates.AccordionSelfDirective
to theAccordionComponent
and ensure it's detected.AccordionSelfDirective
to nestedAccordionItemComponent
and confirm it's detected within the parentAccordionComponent
.AccordionComponent
can access directives applied onAccordionItemComponent
and vice versa.AccordionItemComponent
instances to ensure all directives are correctly queried.Screenshots (if applicable)
No UI changes were made in this update.
Checklist
Additional Notes
@ContentChildren
decorator works as expected across multiple levels of nested content projection.AccordionComponent
orAccordionItemComponent
.