Skip to content
angular challenges logo Angular Challenges

๐ŸŸข Content Projection Default

Challenge #57

Created by Thomas Laforge

Information

Content projection in Angular allows developers to create flexible and customizable components by passing content from the parent component to the child component dynamically using <ng-content>.

Currently, we have a shared component that relies on input properties to receive and display data. However, we want to improve its flexibility by replacing all inputs with content projection while maintaining the same appearance and behavior.

Statement

Your task is to refactor the existing shared component to remove all input properties and instead use Angularโ€™s <ng-content> for content projection. After your modifications, the application should look and function exactly as before, but without any input.

Steps to complete:

  • Identify all input properties in the shared component.
  • Remove them and replace them with appropriate <ng-content> containers.
  • Adjust the parent component to pass the necessary content using content projection instead of binding to inputs.
  • Ensure that the application still displays the same UI and behavior after the changes.

Constraints

  • You must not use any input in the shared component.
  • The applicationโ€™s UI and functionality must remain unchanged after the refactoring.
  • You must use <ng-content> for content projection.
  • Do not introduce additional properties or services to pass data.
  • Ensure that projected content is correctly styled and positioned as before.

Contributors

Thanks to all the contributors who have helped make this documentation better!

  • tomalaforge