0

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.

5
  • stackoverflow.com/questions/25182830/… Commented Mar 5, 2016 at 9:39
  • item is MVC viewModel property OR angular variable ? Commented Mar 5, 2016 at 9:40
  • @PankajParkar Angular property Commented Mar 5, 2016 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 Commented Mar 5, 2016 at 9:44
  • 1
    @KartikeyaKhosla Thank you that link helped Commented Mar 5, 2016 at 9:48

1 Answer 1

1

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>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.