Show Image with dinamically src



Hi, i have to set an Image src with a value that i receive from a json file.
The value is ~/images/flags/name.png
I put this record on the Image tag in this way
< Image src=" ‘item.nomeBandiera’ " height=“24” width=“24” >< /Image >
If i try to print as a label text the item.nomeBandiera i can see the right string but i cant display the image.
In the console i receive this messae:
JS: Error in downloadBitmap - no protocol: ‘item.siglaBandiera’

Ho can i do this work?
Thank you


Post your code so we can find something, from the error it just looks like it takes item.nomeBandiera as URL (plain string) instead of dynamic input?


< StackLayout >
< Image src=item.siglaBandiera class=“action-image” height=“24” width=“24” >< /Image >
< Label [text]=‘item.nomeNave’ >< /Label >
< /StackLayout >


So looking at your code I guess you are using Angular and src is assigned as string, you must use property binding to get value from item.siglaBandiera.


Try this :

    <Image [src]='item.siglaBandiera' class='action-image' height='24' width='24'>
    <Label [text]='item.nomeNave'></Label>


Thank to all!!
in this way work
< Image [src]=item.siglaBandiera.toString() class=“action-image” height=“24” width=“24” >< /Image >