【问题标题】:use data from ng-repeat in @ajax.actionlink在 @ajax.actionlink 中使用来自 ng-repeat 的数据
【发布时间】:2014-09-02 04:56:05
【问题描述】:

我正在尝试将 som 动态数据加载到 @ajax.actionlink

<tr ng-repeat="child in row.child" ng-if="row.visible" class="expand-wrapper">                         
    <td>
        @Ajax.ActionLink("{{child.contractname}}", "home", "index", new { value = "{{child.contractId}}" }, new AjaxOptions { HttpMethod = "POST", OnSuccess = "window.location.reload()" })
    </td>
</tr>

链接文本数据渲染得很好,但value = "{{child.contractId}}" 根本没有渲染。它给了我这个url = someurl/home?value=%7B%7Bchild.contractId%7D%7D

【问题讨论】:

  • 添加一些真实的代码,并在任何人尝试解决它之前对其进行格式化

标签: ajax json angularjs model-view-controller


【解决方案1】:

自己找到了答案。

&lt;a href="@Url.Action("Index", "Home")/{{child.contractId}}" target="_self"&gt;Index&lt;/a&gt;

【讨论】:

    【解决方案2】:

    您不能以这种方式使用 MVC Html Helper,因为您的代码是在服务器端生成的。并且大括号被转换为 %7B 这应该会有所帮助

    <a data-ajax="true" data-ajax-method="POST" data-ajax-success="window.location.reload()" href="/index/home?value={{child.contractname}}">{{child.contractname}}</a>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多