$scope.addUpdateList = function (item){
$scope.targetlist.push(item);
}
$scope.updateTarget = function(){
$http.post('${pageContext.request.contextPath}/products/productsUpdate',
{targetList: $scope.targetList});
}
body
<tr ng-repeat="item in selectResult track by $index | orderBy : 'itemID'">
<td><input ng-change="addUpdateList(item)" type="text" ng-model="item.siteCode" disabled></td>
<td><input ng-change="addUpdateList(item)" type="text" ng-model="item.itemID" disabled></td>
<td><input ng-change="addUpdateList(item)" type="text" ng-model="item.itemName"></td>
<td><input ng-change="addUpdateList(item)" type="text" ng-model="item.itemAmt"></td>
<td><select ng-change="addUpdateList(item)" ng-model="item.kitchenPRT_Y">
<option>Y</option>
<option>N</option>
</select>
</td>
chrome error
TypeError: Cannot read property 'push' of undefined at m.$scope.addUpdateList
spring error
14:48:52.812 [tomcat-http--43] DEBUG o.s.w.s.m.m.a.ExceptionHandlerExceptionResolver - Resolving exception from handler [public void sipos.gim.pos.main.controller.ProductsinfomationController.productsUpdate(java.util.Locale,org.springframework.ui.Model,java.security.Principal,java.util.List,javax.servlet.http.HttpServletRequest) throws java.lang.Exception]: org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token at [Source: org.apache.catalina.connector.CoyoteInputStream@c42dd57; line: 1, column: 1]; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token at [Source: org.apache.catalina.connector.CoyoteInputStream@c42dd57; line: 1, column: 1] 14:48:52.812 [tomcat-http--43] DEBUG o.s.w.s.m.a.ResponseStatusExceptionResolver - Resolving exception from handler [public void sipos.gim.pos.main.controller.ProductsinfomationController.productsUpdate(java.util.Locale,org.springframework.ui.Model,java.security.Principal,java.util.List,javax.servlet.http.HttpServletRequest) throws java.lang.Exception]: org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token at [Source: org.apache.catalina.connector.CoyoteInputStream@c42dd57; line: 1, column: 1]; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token at [Source: org.apache.catalina.connector.CoyoteInputStream@c42dd57; line: 1, column: 1] 14:48:52.812 [tomcat-http--43] DEBUG o.s.w.s.m.s.DefaultHandlerExceptionResolver - Resolving exception from handler [public void sipos.gim.pos.main.controller.ProductsinfomationController.productsUpdate(java.util.Locale,org.springframework.ui.Model,java.security.Principal,java.util.List,javax.servlet.http.HttpServletRequest) throws java.lang.Exception]: org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token at [Source: org.apache.catalina.connector.CoyoteInputStream@c42dd57; line: 1, column: 1]; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token at [Source: org.apache.catalina.connector.CoyoteInputStream@c42dd57; line: 1, column: 1]
What's wrong the code?
$scope.addUpdateList=function(item){