Reputation: 650
I try to send an object, containing an object that contains raw html
template: "<div class="dd_snippet" id="snippet_84909"><div class="row"> <div class="col-xs-12"><h1 class="padding10">Big title</h1></div></div></div><div class="dd_snippet" id="snippet_46417"><div class="row"><div class="col-xs-12"><h2 class="padding10">Middle title</h2></div></div></div><div class="dd_snippet" id="snippet_20274"><div class="row"><div class="col-xs-12"><h3 class="padding10">Small title</h3></div></div></div>"
I send it like this :
action.addCampaign = function(idLieu, campaign){
console.log("Campaign : ", campaign);
return $http({
url: $company.backend+'/lieu/'+idLieu+'/campaign',
method: 'POST',
data: $.param(campaign),
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
});
}
When I display what the server received, I notice that the object containing html is null
Can someone tell me why ?
Thanks for your answers !
Upvotes: 0
Views: 45
Reputation: 19071
You have some quotes issue; You can either replace the ones around the javascript string with single quotes. Or escape every double-quote inside your string.
template: '<div class="dd_snippet" id="snippet_84909"><div class="row"> <div class="col-xs-12"><h1 class="padding10">Big title</h1></div></div></div><div class="dd_snippet" id="snippet_46417"><div class="row"><div class="col-xs-12"><h2 class="padding10">Middle title</h2></div></div></div><div class="dd_snippet" id="snippet_20274"><div class="row"><div class="col-xs-12"><h3 class="padding10">Small title</h3></div></div></div>'
Upvotes: 4