Reputation: 2449
Is is possible to bind in side a style with knockout? See the example:
<div style="background: url('!!INSERT IMAGE LINK HERE!!!') no-repeat; padding-left: 25px">
I know i can make a string in my view model that contains it all, but i would like to keep the css seperated from my view model.
Upvotes: 3
Views: 360
Reputation: 7636
You could use a style binding to set the background depending on a property on the view model, see http://knockoutjs.com/documentation/style-binding.html
Having said that I generally think it's better separation if you use the css binding http://knockoutjs.com/documentation/css-binding.html and define a css class to represent the state.
Upvotes: 1