在angular从servlet中获取的list数据是字符串格式,需要转为json格式,于是使用语法:
$scope.findOne=function(id){ typeTemplateService.findOne(id).success( function(response){ $scope.entity= response; $scope.entity.brandIds= JSON.parse($scope.entity.brandIds);//转换品牌列表 $scope.entity.specIds= JSON.parse($scope.entity.specIds);//转换规格列表 $scope.entity.customAttributeItems= JSON.parse($scope.entity.customAttributeItems);//转换扩展属性 } ); }