したがって、私はangularJS配列を持ち、ASP.Net MVCメソッドに渡し、そのデータをデータベースに格納したいと考えています。anglejs配列をASP.Net MVCメソッドに渡す
配列は、以下のようになります。
telephone = [{'id':'T1', 'contactN':'212-289-3824'}, {'id':'T2', 'contactN':'212-465-1290'}];
私はボタンをクリックすると、それは以下のJS機能を起動:
$scope.updateUserContacts = function() {
$http.post('/Home/UpdateUserContacts', { contactsData: $scope.telephone })
.then(function (response) {
$scope.users = response.data;
})
.catch(function (e) {
console.log("error", e);
throw e;
})
.finally(function() {
console.log("This finally block");
});
}
私の質問は、私はこれを受け取ることができるか、です私のASP.Net MVCの配列?この配列と互換性のあるフォーマットは何ですか?
以下はASP.Net MVCメソッドの例ですが、渡された配列を受け取るタイプと受け取り方法はわかりません。
[HttpPost] //it means this method will only be activated in the post event
public JsonResult UpdateUserContacts(??? the received array)
{
......
}