访问 angularJs 中的对象时发生未定义错误
Undefined error when accessing object in angularJs
当我访问以下对象时,它抛出未定义的错误,
{
"code": 422,
"message": {
"address_info.email": [
"The address info.email field is required."
]
},
"debug": null
}
console.log(data.error.message.address_info.email);
我收到错误 data.error.message.address_info is undefined
,那么我怎样才能收到 address_info.email 错误消息?
使用类似地图的语法:
data.error.message["address_info.email"]
当我访问以下对象时,它抛出未定义的错误,
{
"code": 422,
"message": {
"address_info.email": [
"The address info.email field is required."
]
},
"debug": null
}
console.log(data.error.message.address_info.email);
我收到错误 data.error.message.address_info is undefined
,那么我怎样才能收到 address_info.email 错误消息?
使用类似地图的语法:
data.error.message["address_info.email"]