SkyEra

博客园 首页 新随笔 联系 订阅 管理

在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);//转换扩展属性

            }
        );                
    }

 

posted on 2018-11-30 00:07  SkyEra  阅读(138)  评论(0编辑  收藏  举报