Reputation: 22879
I'm using the Javascript template for making a Windows 8 App with Visual Studio.
Setting the background image for one of my items with backgroundImage: : "images/breeds/sheep.jpg" doesn't seem to be working.
{ group: sampleGroups[0], title: "Item Title: 5", subtitle: "", description: itemDescription, content: itemContent, backgroundImage: : "images/breeds/sheep.jpg"}
The location of the image is relative to the root of the file because I assumed the app runs from default.html.
The image shows as a broken link. Any ideas as to what I'm doing wrong here?
UPDATE: Noticed the following error
The app couldn’t resolve ms-appx://8a32c4d0-abb1-413b-8989-339848463d6c/images/breeds/Berrichon_Du_Cher.jpg because of this error: RESOURCE_NOT_FOUND
Upvotes: 1
Views: 1168
Reputation: 1176
Try using the ms-appx
protocol for specifying local files. In your example, you could change the image path to something like "ms-appx:///images/breeds/sheep.jpg"
. You can get some more information on the protocols available for file access in this MSDN doc.
Alternatively, you can just put a / in front of your path to make sure it is being resolved from the project's root. IE, "/images/breeds/sheep.jpg"
Upvotes: 3