My returned data is an array of objects with a nested object. I'm unable to display the 'events' in a v-for loop in my template as I cannot seem to access that part of the returned data.
The data is returned like this (from Vue DevTools):
list: Object
user: "name"
id: "id"
events: Array[3]
0: Object
title: "event 1"
1: Object
title: "event 2"
2: Object
title: "event 3"
Using Vue-resource (via CDN) how do I get display just the events in my template?
Template:
<template id="events-template">
<div v-for="events in list">
@{{events.title}}
</div>
</template>
My application:
Vue.component('events', {
template: '#events-template',
data: function() {
return {
list: []
}
},
created: function() {
this.fetchEventsList();
},
methods: {
fetchEventsList: function() {
this.$http.get('events', function(events) {
this.list = events;
}).bind(this);
}
}
});
list
variable to your question? – Fiete Jan 31 at 19:21