angularjs - Web api model binding doesn't bind the list -


Developing a web API and angular applications, I'm trying to post a list of things that save serverside. Send me a public blank message (list & lt; somethingModel & gt; model) {// model tap is here}

array contains the request body but the model does not bind if I add the ModelBinding attribute to:

  Generic Zero SendMessage ([ModelBinder] list & lt; SomethingModel & gt; Model) I got an empty list, so the question is how do I put a Web API in a list of complex objects Can i bind  

myControllers.controller ('MessageCtrl', ['$ scope', 'somethings', 'message', function ($ scope, somethings, Message) {$ scope.somethings = somethings; var message = new message ($ scope.somethings); $ radius Save = function () {message. $ Save (). Then (function () {$ scope.go ('/ somewhere);});}}]));

More views:

  & lt; Table & gt; & Lt; Thead & gt; & Lt; Tr role = "row" & gt; & Lt; Th & gt; & Lt; / Th & gt; & Lt; Th & gt; Name & lt; / Th & gt; & Lt; Th & gt; Title & lt; / Th & gt; & Lt; / TR & gt; & Lt; / Thead & gt; & Lt; Tbody & gt; & Lt; Tr ng- repeat = "sth in somethings" & gt; & Lt; Td> & Lt; Input type = "checkbox" id = "opt00" name = "selected" ng-model = "sth.Selected" /> & Lt; / Td> & Lt; Td class = "sorting_1" & gt; {{Sth.Name}} & lt; / Td> & Lt; Td square = "" & gt; {{Sth.Title}} & lt; / Td> & Lt; / TR & gt; & Lt; / Tbody & gt; & Lt; / Table & gt;   

If I change the instant messaging service

  var message = new message (new array ($ scope.somethings));   

Then it will be the Jason object which I will get:

  {"0": [["selected": wrong, "name": "Ø ±" ØØا "," title ":" د٠?? ستا٠?? Û ?? "}, {" selected ":" name ":" name 2 "," title ":" title2 "}]} < / Code>  

Update:

Messaging:

  myServices.factory ('message', ['$ Resource ', function ($ resource) {return $ resource (' / api / manual message / send message ', zero);}]);    

Try it out:

  [http post] Public Zero SendMessage ([FromBody] list & lt; SomethingModel & gt; model) {// model tap is here}    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -