修改typeTemplateController.js的findOne方法
//查询实体
$scope.findOne=function(id){
typeTemplateService.findOne(id).success(
function(response){
s
c
o
p
e
.
e
n
t
i
t
y
=
r
e
s
p
o
n
s
e
;
∗
∗
scope.entity= response; **
scope.entity=response;∗∗scope.entity.brandIds=JSON.parse($scope.entity.brandIds);//转换品牌列表
s
c
o
p
e
.
e
n
t
i
t
y
.
s
p
e
c
I
d
s
=
J
S
O
N
.
p
a
r
s
e
(
scope.entity.specIds= JSON.parse(
scope.entity.specIds=JSON.parse(scope.entity.specIds);//转换规格列表
s
c
o
p
e
.
e
n
t
i
t
y
.
c
u
s
t
o
m
A
t
t
r
i
b
u
t
e
I
t
e
m
s
=
J
S
O
N
.
p
a
r
s
e
(
scope.entity.customAttributeItems=JSON.parse(
scope.entity.customAttributeItems=JSON.parse(scope.entity.customAttributeItems);//转换扩展属性**
}
);
}
从数据库中查询出来的是字符串,我们必须将其转换为json对象才能实现信息的回显。
数据库中字符串转换为json对象实现信息回显。
最新推荐文章于 2024-05-15 10:46:25 发布