Georgios
Georgios

Reputation: 1483

Passing Data from Angular to Razor (MVC5)

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 })

Upvotes: 0

Views: 1470

Answers (1)

Chernikov
Chernikov

Reputation: 857

You need put ng- before href:

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

Also ng-src for src attribute.

Upvotes: 4

Related Questions