[Vuejs]-How do I pass data from a vue-resource method to my view layer in a vue component?

2👍

Since you used an anonymous function, it has its’ own scope when you call this. If you use an arrow function you can get rid of that

resourceService.getMovies().then((result) => {
  this.test = result
})

I also recommend looking at the docs for creating resources: https://github.com/vuejs/vue-resource/blob/master/docs/resource.md

This is a way to create a class that automatically has methods for get, update, delete, etc.

👤Jeff

Leave a comment