0

This might be a simple projection recipe, but I haven't been able to find the answer, the simple question is

I have a loop with an ng-content in it,

so lets say

custom-component

has this in its view file

<div *ngFor="let tiledata of TileData">
    <ng-content></ng-content>
</div>

now if I want to access the single instance tiledata and pass it out to be used by the html in the component kind of like this

<custom-component>
    {{tiledata.name}}
    <br>
</custom-component>

so it should be shown like this

bob
tim
skip

so bottom line the tiledata of TileData would be available in the component content to allow you to write html to show the list

let me know if this makes sense,

Community
  • 1
  • 1
  • it's not very clear but if you are trying to pass value from child component to parent component you will has to `emit` the value. use output in the child component and the value will be available in the parent component. – Abhishek Ekaanth Dec 21 '17 at 05:01
  • the issue is passing not the entire array but that one element from the ngFor for use inside the ng-content by the calling page, I hope that clears it up – Liam Bayly Dec 21 '17 at 05:36

0 Answers0