Hey dynamicweb,
I upgraded to version 8.4.1.6 because I want to be able to output javascript from razor template but I have an issue.
I created a new page and set the content-type to be text/javascript.
The template looks like this:
<!--@If(1 = 2)-->
<div id="content-main" class="dwcontent" title="Main content" data-settings="template:moduleonly.cshtml">
</div>
<!--@EndIf-->
@{
var props = new List<string> { "1", "2" };
}
$(document).ready(function() {
var props = [
@foreach (var prop in props)
{
}
];
alert("OK");
});
The problem is that when this template is rendered, for some reason it appends </string> at the end of the file.
$(document).ready(function() { var props = [ ]; alert("OK"); }); </string>
When I don't have a foreach section it is working. How can I fix this?