[Vuejs]-Vuejs axios data not populated

2👍

The problem is with ‘this’ inside the axios callback. You should use arrow function to keep the context

axios
    .get(apiUrl)
    .then(response => {
      this.locations = constructLocationDropDownValues(response, modelName)
      this.categories = constructCategorySubCategoryDropDownValues(response,modelName)
    })
    .catch(function (error) {
      console.log(error)
    })

Leave a comment