ListView.itemTemplate and Images in NativeScript
Asked 07 September, 2021
Viewed 350 times
  • 57
Votes

I am trying to build a Contacts List type POC for NativeScript. And I would like to have an image and name in a list item. The code that I am using for the layout is as follows

<Page loaded="pageLoaded">
    <ListView items="{{ myItems }}">
        <ListView.itemTemplate>
            <Image src="{{ imageSrc }}" />
            <Label text="{{ title }}" />
        </ListView.itemTemplate>
    </ListView>
</Page>

Apparently, the title value is coming up fine, but the image is not showing up at all. When I try to put the same Image code in an empty page, NativeScript builds the page with image.

Can anyone tell me why the image is not coming up in the listview template? And how can it be displayed?

Thanks

1 Answer