0

I created a project in MVC5 over Entity Framework and AngularJS. Now, what I want is to pass every database object to an MVC controller, in order to update their values. (ex: to modify a "customer" value) The following code doesn't work..

 <table class="table">                
                    <tr ng-repeat="r in customers">
                        <td>{{r.ID}}</td>
                        <td>{{r.LastName}}</td>
                        <td>{{r.FirstName}}</td>
                        <td>{{r.Phone}}</td>
                        <td>{{r.Email}}</td>
                        <td><a href="@Url.Action("Edit","Edit")?id={{r.ID}}"></a></td>
                    </tr>
                </table>

Please help me about how to pass r.ID to the razor above

@Html.ActionLink("Edit", "Edit", new { id = r.ID })
tereško
  • 58,060
  • 25
  • 98
  • 150
Georgios
  • 1,454
  • 6
  • 17
  • 34
  • 1
    refer [this](http://stackoverflow.com/questions/34979126/pass-angularjs-expression-variable-to-asp-net-mvc-action-link-as-route-parameter),[this](http://stackoverflow.com/questions/25182830/html-actionlink-and-angularjs-value),[this](http://stackoverflow.com/questions/316889/asp-net-mvc-passing-an-id-in-an-actionlink-to-the-controller) – Kartikeya Khosla Mar 30 '16 at 12:19

1 Answers1

4

You need put ng- before href:

<a ng-href="@Url.Action("Edit","Edit")?id={{r.ID}}"></a>

Also ng-src for src attribute.

Chernikov
  • 847
  • 1
  • 11
  • 21