Angular 18 New Feature for ng-content: Default Content

Опубликовано: 28 Сентябрь 2024
на канале: Igor Sedov
4,380
175

Angular 18 brings a new feature for the ng-content element called default content. In this video I briefly explain how this works using two component templates as an example. The new release of the framework has the ability to optimize the use of templates using this feature.

Now we can place content between the opening and closing ng-content tags. In previous versions this would have resulted in an error. Starting from version 18, this is acceptable and allows you to specify the content that will be used if the corresponding content from another component template is not passed to this block.

I use a simple and beautiful visual style to explain things clearly. I hope this is helpful!

And thanks to the ‪@Angular‬ team for all their hard work on Angular 18!👍

ℹ️ Source: https://github.com/angular/angular/pu...

Angular is a registered trademark of Google and/or its affiliates. I'm not affiliated, associated, authorized, endorsed by, or in any way officially connected with Google.

#angular #angular18