Content Projection Fallback in ng-content in Angular

Loading

Reading Time: 3 minutes Introduction In this blog post, I want to describe a new Angular 18 feature called content projection fallback in ng-contentWhen content exists between the ng-content opening and closing tags, it becomes the fallback value. When projection does not occur, the fallback value is displayed. Bootstrap Application Bootstrap the component and the application configuration to start … Read more

Angular and Storybook – Component with content projection

Loading

Reading Time: 3 minutes In Bonnie’s visual DOM course, I learnt the technique of applying multiple content projections in a component. I created a FoodMenuCardComponent with two content projections; i.e., a component with two <ng-content> elements. The first <ng-content> has selector ‘head’ that projects FoodQuestion component and the second <ng-content> has selector ‘body’ that projects a list of FoodChoice … Read more