我的视图生成一些js代码。我需要将我的Model转换为接口类型以获取一些属性。
下面是一个示例:
<script type="text/javascript" language="javascript">
var js_array = [];
@for (var i = 0; i < ( Model as MyProject.Models.IMyInterface ).PropertyList.Count; i++) {
<text>
js_array['@( Model as MyProject.M
var temp = [
{
text:'some text and then % sign and then, again % sign',
link: 'another text with %',
},
];
我想在对象的%数组中用\%替换所有的temp符号。我该怎么做呢?
期望输出:
var temp = [
{
text:'some text and then \% sign and then, again \% sign',
link: 'another text with \%