如何将ID放入AngularJS的@ Url.Action中?

时间:2017-03-27 01:02:16

标签: asp.net angularjs asp.net-mvc

我正在使用AngularJS来显示记录

<tr class="highlight" ng-repeat="sector in sectors | filter:searchText">
    <td>
        {{sector.Name}}
    </td>
</tr>

我想使用

{{sector.Name}}中添加一个链接
<a href="@Url.Action("Delete", "Sectors")">
{{sector.Name}}
</a>

问题在于我认为不能{{sector.ID}} @Url.Action这样<a href="@Url.Action("Delete", "Sectors", new { id = {{sector.ID}} })">

那么无论如何都要在链接中使用我的sector.ID吗?

1 个答案:

答案 0 :(得分:0)

没关系。我用这个

找到了答案
<a ng-href="@Url.Action("Details", "Sectors")?id={{sector.ID}}">