【发布时间】:2013-04-05 15:19:13
【问题描述】:
我正在使用 ng-repeat 来显示一个中心表。对于每个中心,我想提供一个使用角度数据的编辑按钮:
<table data-ng-init="centers" data-ng-model="Centers">
<tr data-ng-repeat="center in centers">
<td class="center-logo">
</td>
<td class="center-name">
<h4>{{center.Name}}</h4>
</td>
<td class="center-address">{{center.City}}, {{center.Country}}
</td>
<td>{{center.StudyVersion}}</td>
<td>
<a href="@Url.Action("Edit","Center",new {code = {{center.Code}}})" class="btn">
<i class="icon-edit"></i>Edit
</a>
</td>
</tr>
</table>
现在 VS 在表达式上给我一个错误:
@Url.Action("Edit","Center",new {code = "{{center.Code}}"})
我似乎无法找到一种方法,因此 razor 使用来自 {{center.Code} 的值,就像它在纯 html 中所做的那样。
【问题讨论】:
-
能否请您发布您从 Studio 收到的错误?
-
在 {{center.Code} 它说表达式预期。
-
您的声明:"似乎找不到方法,因此 razor 使用 {{center.Code} 中的值,就像在纯 html 中一样。" 是有点混乱。 Razor 是服务器端的,但我相信您使用它们时的双花括号,以及包含的值
center.code仅对客户端的 AngularJS 有意义。
标签: razor asp.net-mvc-4 angularjs angularjs-ng-repeat