I'm new to vue.js I'm working with the code below and run into some problem. I was trying to access data myData within a for loop within a method myFunction in the method object using this.myData but it is inaccessible/out of scope
export default MyComponent.extend({
data:function(){
return {
myData: []
}
},
ready:function(){
this.myFunction();
},
methods:{
myFunction:function(){
Vue.http.get('/getdata').then((response) => {
for (var i = 0; i < response.data.info.length; i++) {
this.myData.push(response.data.info[i].address);
}
});
}
}
})