Ng-content inside a Listview isn't being injected with content


#1

I have a component named ItemsSelector which contains a ListView :

<ListView class="list-group" [items]="[1,22,34,6]" style="height:1250px">
    <ng-content></ng-content>
</ListView>

This is how I use the ItemsSelector component:

<StackLayout class="home-panel">
	<ItemsSelector>
		<ng-template let-item="$implicit" let-i="index">
			<Label [text]="'111'" color="black"></Label>
			<Label [text]="'222'" color="black"></Label>
		</ng-template> 
	</ItemsSelector>
<StackLayout>

But it seems that ng-content is not being injected with content , And it display items not like I wanted

image

BTW - According to the docs , this is the way how to use Listview :

enter image description here

So all I was doing is to send the view from outside , but without success…

Question:

Why isn’t ng-content being injected with the content I provide ?

Playground


#2

Interesting problem. Try something like this: https://stackoverflow.com/a/46810906/7500705

Maybe that’s the solution. I think after all it’s more of an Angular type of problem rather than NativeScript.
Please make sure to share your experience. I’m also interested in this.


#3

Thanks , it doesn’t work either.


#4