This is a migrated thread and some comments may be shown as answers.
Problem with style binding a background image
0 Answers 70 Views
This is a migrated thread and some comments may be shown as answers.
Brad Sumner
Top achievements
Rank 1
Brad Sumner asked on 23 May 2012, 03:27 PM
I'm trying to bind and image to the background of a div but having trouble due to the need to add 'url()' to the image.  In the example below if selectedPhoto is just the path to the file "/image/somefile.jpg" then it doesn't work.  If selectedPhoto is "url('/image/somefile.jpg')" then it works.  Is there a way to add in url() in the binding around the variable selectedPhoto without having to including it in the value of the variable?

data-bind="style: { backgroundImage:  selectedPhoto  }"

I cross posted this under an older thread but wasn't sure if I would get a response.

http://www.kendoui.com/forums/framework/mvvm/problem-in-binding-style-in-template.aspx

Thanks,
Brad

No answers yet. Maybe you can help?

Tags
MVVM
Asked by
Brad Sumner
Top achievements
Rank 1
Share this question
or