October 2017
Intermediate to advanced
280 pages
6h 50m
English
Another typical use case of content projection is when we pass content to a custom Angular component or AngularJS directive and we want different parts of this content to be projected to different locations in the template.
For instance, let's suppose we have a panel component that has a title and a body, and we can use it in the following way:
<panel>
<section class="panel-title">Sample title</section>
<section class="panel-content">Content</section>
</panel>
The template of our panel component looks like this:
<div class="panel"> <div class="panel-title"> <!-- Project the content of panel-title here --> </div> <div class="panel-content"> <!-- Project the content of panel-content here --> </div> </div>` ...Read now
Unlock full access