代码下方
.state('list', {
url: "/list",
templateUrl: "list.html",
controller: "ListController as list"
})
.state('details', {
url: "/details:itemId",
templateUrl: "details.html",
controller: "ListController as list"
})
.controller("ListController", function($stateParams){
this.items = [
{
itemId: 1,
name: "item1",
color: "red",
size: "big"
},
...
];
this.id = $stateParams;
})
<h1>list</h1>
<ul>
<li ng-repeat="item in list.items">
<a ui-sref="details({itemId:item.itemId})">{{item.name}}</a>
</li>
</ul>
<h1>details</h1>
<ul ng-repeat="detail in list.items | filter: list.id">
<li >{{detail.name}}</li>
<li >{{detail.color}}</li>
<li >{{detail.size}}</li>
</ul>
预期输出为document.writeln("Caracteres escapados {\u55e8\uff0c\u4f60\u597d\u5417}: "
+ "\u55e8\uff0c\u4f60\u597d\u5417");
当前输出为:\u55e8\uff0c\u4f60\u597d\u5417: 嗨,你好吗
上述代码需要进行哪些修改?
答案 0 :(得分:1)
只需转义您想要显示的代码的反斜杠而不进行翻译:
document.writeln("Carácteres escapados \\u55e8\\uff0c\\u4f60\\u597d\\u5417: \u55e8\uff0c\u4f60\u597d\u5417");
&#13;
答案 1 :(得分:1)
你需要逃避反斜杠并移除大括号。
document.writeln("Caracteres escapados \\u55e8\\uff0c\\u4f60\\u597d\\u5417 "
+ "\u55e8\uff0c\u4f60\u597d\u5417");