Adding Native Fallback Content for ng-content in Angular Components

Поділитися
Вставка
  • Опубліковано 26 лип 2024
  • When building Angular components, have you ever found yourself looking for a way to provide fallback content for projected content slots using the ng-content element? If so, you’ve probably been able to find some work arounds to do it but, they’re probably not something you really want to do. It would be better if this concept was built-in to the framework, right? Well, this is actually happening in the latest versions of angular. In this video I’ll show you exactly how it works. Alright, let’s get to it.
    ------------------------------------------------------------------------------
    💖 Help Support the Channel:
    If you found this helpful and want to show some love, you can always buy me a coffee (buymeacoffee.com/briantreese)!
    ------------------------------------------------------------------------------
    🔗 Demo Links:
    - Before (stackblitz.com/edit/stackblit...)
    - After (stackblitz.com/edit/stackblit...)
    ------------------------------------------------------------------------------
    📖 Chapters:
    0:00 - Introduction
    0:38 - Angular version disclaimer
    1:11 - The demo application
    2:43 - Converting string attributes to slot content projection with ng-content
    4:19 - Adding fallback slot content in ng-content regions
    5:31 - Fallback content doesn’t work when slots are conditional
    6:45 - Conclusion
    ------------------------------------------------------------------------------
    #angular #angular_developer #angulartraining #javascript #typescript #frontend #angularcourse #angular_components #angular_content_projection #
  • Наука та технологія

КОМЕНТАРІ • 2

  • @innaatanassoff525
    @innaatanassoff525 2 місяці тому

    Your content is amazing! Hope more people discover your channel. Keep it going!

    • @briantreese
      @briantreese  2 місяці тому

      Thanks for the feedback, I appreciate it!