March 2017
Intermediate to advanced
821 pages
18h 21m
English
Elements present inside the tags of a component are called content children, and elements present inside the template of a component are called view children.
To display the content children of a component in the component's view, we need to use the <ng-content> tag. Let's look at an example of this.
Place this code above the App component's code:
var ListItem = ng.core.Component({
selector: "item",
inputs: ["title"],
template: "<li>{{title}} | <ng-content></ng-content></li>",
}).Class({
constructor: function(){}
})
var List = ng.core.Component({
selector: "list",
template: "<ul><ng-content select='item'></ng-content></ul>"
}).Class({
constructor: function(){}
})Now, change the App component's code ...
Read now
Unlock full access