我的支持是在meta
字段中向我提供有关回复的一些信息。例如,当转到#/phoneNumbers/phonelocations/index
时,会向/api/phonelocations
发送请求,这是收到的数据:
{
"meta": {
"api_action": "find_all",
"api_id": "phonelocations",
"content_type": "application/json",
"error_code": 200,
"errors": [
{
"admin_message": "",
"code": 200,
"message": ""
}
],
"message": "Successfully read phonelocations",
"success": true
},
"phonelocations": [
{
"_id": "0",
"city": "Berlin",
"count": 10,
"country": "DE",
"country_name": "Germany",
"loctype": "GEO",
"loctype_human": "Geographical number",
"subtype": "49GEO",
"subtype_human": "German geographical number",
"type": "phonelocation-faketype"
},
...
]
}
这存在于来自后端的所有回复中。我想使用_reply_meta.message
中的消息将其显示给用户。 Ember中是否有标准方法来访问回复的元信息?
答案 0 :(得分:1)
在您的情况下,只需使用store.metadataFor(type)
:
var meta = this.store.metadataFor('phonelocation');
// all metadata is in meta object
meta.message // => "Successfully read phonelocations"
中查看此内容