I want to change a background image of a div by css using the json data returned using Emberjs. However the background image doesn't change in the following code.
However when I remove the return and put the after model code within the model it changes the background image, what is the problem in the code and how can I fix it? Thanks
App.ERoute = Ember.Route.extend({
model: function()
{
var json = $.getJSON('url').done(function(result){
return result;
});
return json;
},
afterModel : function(model)
{
$('#eventheader::shadow #headerBg').css('background-image' , 'url(' + model.image + ')';
}
});