I want to crate a nested layer.
@Component({
selector: 'items-collection',
template: '<ng-content></ng-content>'
})
export class ItemsComponent {
}
HTML usage is like this:
<items-collection>
<item [name]="item-1"></item>
<item [name]="item-2"></item>
<item [name]="item-3"></item>
</items-collection>
But if I set a json source data of items-collection the data will append dynamically.
@Component({
selector: 'items-collection',
template: '<ng-content></ng-content>'
})
export class ItemsComponent {
private jsondata:any[] = [
{"name": "item-8"},
{"name": "item-9"},
{"name": "item-15"}
]
}
<items-collection source="jsondata">
<item [name]="item-1"></item>
<item [name]="item-2"></item>
<item [name]="item-3"></item>
</items-collection>
Is this possible?