简体   繁体   English

Razor语法代码片段后,Razor语法会阻止空间

[英]Razor Syntax prevent space after razor code snippet

Im trying to get this as the result javascript: 我试图得到这个结果javascript:

var targetChart = mymodel_chart;

from this: 由此:

var targetChart = @Model.visualChartName/*dont know what to do here*/_chart;

But theres always a whitespace rendered in between the two statements on the right side, like this: 但是在右侧的两个语句之间总是有一个空格,如下所示:

var targetChart = mymodel _chart;

How can I prevent this whitespace to be written there? 如何防止在那里写这个空格?

有各种解决方案,如果我理解正确,这可以是一个:

var targetChart = @(Model.visualChartName+"_chart"); //based that visualChartName is a string

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM