Shak Ham
Shak Ham

Reputation: 1269

Angularjs and Asp.Net MVC Controller

I'd like to use AngularJS for databinding but I also want to keep a Send button that will submit the form sending the model (which the controller will change to a c sharp object) without ajax. I know I have the model in the $scope and that it is in json format, but it seems that the only way to send it to an Action is via Ajax and not by submitting the entire form.

Upvotes: 1

Views: 1002

Answers (1)

Shahed
Shahed

Reputation: 898

When binding the data using AngularJS if you specify the name attribute, the action method in C# should receive the values.

For example, <input type='text' name='userName' value={{userName}} />

When user clicks the submit button, the server site method should receive the value if you have a variable named userName.

Upvotes: 1

Related Questions