0
0
Angularframework~10 mins

ng-content for slot-based composition in Angular - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to insert default content using .

Angular
<div>
  <ng-content [1]></ng-content>
</div>
Drag options to blanks, or click blank then click option'
Aselect="header"
Bselect
Cdefault
Dslot
Attempts:
3 left
💡 Hint
Common Mistakes
Adding a select attribute when default content is needed
Using 'slot' attribute which is not valid in Angular
2fill in blank
medium

Complete the code to project content into a named slot called 'header'.

Angular
<ng-content [1]></ng-content>
Drag options to blanks, or click blank then click option'
Aslot="header"
Bid="header"
Cname="header"
Dselect="header"
Attempts:
3 left
💡 Hint
Common Mistakes
Using slot attribute which is not recognized by Angular
Using name or id attributes which do not work for content projection
3fill in blank
hard

Fix the error in the content projection selector to match elements with attribute 'footer'.

Angular
<ng-content [1]></ng-content>
Drag options to blanks, or click blank then click option'
Aselect="footer"
Bselect="[footer]"
Cselect=".footer"
Dselect="#footer"
Attempts:
3 left
💡 Hint
Common Mistakes
Using select="footer" which selects elements named footer, not attributes
Using class or id selectors which do not match attribute selectors
4fill in blank
hard

Complete the code to project content with attribute 'sidebar' and default content fallback.

Angular
<ng-content [1]></ng-content>
<ng-content ></ng-content>
Drag options to blanks, or click blank then click option'
Aselect="[sidebar]"
Bselect="default"
Dselect="*"
Attempts:
3 left
💡 Hint
Common Mistakes
Using select="default" which is not a valid selector
Adding select attribute to default content projection
5fill in blank
hard

Fill both blanks to project content for 'header', 'footer', and default slots.

Angular
<ng-content [1]></ng-content>
<ng-content [2]></ng-content>
<ng-content ></ng-content>
Drag options to blanks, or click blank then click option'
Aselect="header"
Bselect="footer"
Dselect="main"
Attempts:
3 left
💡 Hint
Common Mistakes
Using select attribute for default slot
Mixing up slot names or selectors