简体   繁体   English

在MVC @ Url.Action帮助器方法中容纳Angular JS JSON对象值?

[英]Geeting Angular JS JSON object value in MVC @Url.Action helper Method?

How can I pass an Angular scope value to the rout value object of @Url.Action method? 如何将Angular作用域值传递给@ Url.Action方法的rout值对象?

here is what i have 这是我所拥有的

<a href="@Url.Action("Edit", "Product", new { id = ""})">
   {{product.Name}}
 </a>

i want the value of id = product.Id 我想要id的值= product.Id

How can I do that ? 我怎样才能做到这一点 ?

Product object has been defined in the controller scope and it is a JSON format. 产品对象已在控制器范围内定义,并且为JSON格式。

You should you ngHref 你应该你ngHref

<a ng-href="Action("Edit", "Product", ...)">
   {{product.Name}}
 </a>

and in controller scope it will be method: 在控制器范围内它将是方法:

$scope.Action = function( ....

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM