Я использую can.Component
для отправки JSON на странице.Как получить дополнительную информацию от json?
can.Component.extend({
tag: "some-app",
scope: {
items: new Items.List({}),
displayedItems: function() {
...
return items;
}
},
helpers: {
...
},
events: {
"{Items} created": function (Items, ev, newItem) {
...
}
}
})
Как я могу получить раздел «meta» полученного JSON (ниже) для области или помощников?
{
"data": [
{
"description": "Some text",
"id": 1,
"measurement": "pcs",
"name": "Name of item",
"resource_uri": "/api/v1/item/1/"
},
{....}, {....}
}
],
"meta": {
"limit": 20,
"next": null,
"offset": 0,
"previous": null,
"total_count": 3
}
}
я могу получить его в консоли с Items.findAll().then(function(info){console.log(info.attr('meta'))})
, но я нуб в (может.) JS и не может понять, как получить его на месте, мне нужно.