Join the Stack Overflow Community
Stack Overflow is a community of 6.5 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I am trying to add angularjs in an already build project. I am using angularjs for the index page. I need to call the mvc controller for edit and delete instead of angularjs controller and i need to pass id to the mvc controller. I have used the code.

 <a href="@Url.Action("EditNewsLetter","NewsLetter")/?id = {{item.Id }}">Edit</a> |
 <a href="@Url.Action("DeleteNewsLetter","NewsLetter")/?id = {{item.Id }}">Delete</a>

but it is not passing the values to the controller when i am clicking.

It shows error id cannot be null.I don't have much experience in angular. So please help me to get out of this problem.

share|improve this question
    
    
item is MVC viewModel property OR angular variable ? – Pankaj Parkar Mar 5 at 9:40
    
@PankajParkar Angular property – simba Mar 5 at 9:42
    
@simba then it looks good for me, I think just remove whitespace & make it <a href="@Url.Action("EditNewsLetter","NewsLetter")/?id={{item.‌​Id }}"> should restrict encoding of whitespace while hitting URL to server – Pankaj Parkar Mar 5 at 9:44
1  
@KartikeyaKhosla Thank you that link helped – simba Mar 5 at 9:48
up vote 0 down vote accepted

This worked.

<a data-ng-href="@Url.Action("EditNewsLetter","NewsLetter")/{{item.Id}}" target="_self">Edit </a> <a data-ng-href="@Url.Action("DeleteNewsLetter","NewsLetter")/{{item.Id}}" target="_self">Delete </a>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.