Below is a functional example in my CodePen showing what should be happening. Everything is working as intended with hard coded data.
CodePen: https://codepen.io/anon/pen/XxNORW?editors=0001
Hard coded data:
info:[
{
"id": 1,
"title": "Title one",
"category_data": {
"2": "Team",
"7": "Queries"
}
}
],
Issue:
However, when I replace the hard coded data with an AXIOS get call, the checkboxes in the CodePen do not work as expected. The All checkbox gets checked correctly, but the others do not.
I suspect that the slight delay in loading the API could be the reason for this behavior.
mounted() {
this.getData();
},
methods: {
getData: function() {
axios
.get('https://EXAMPLE.com/API/')
.then(response => {
this.info = response.data
this.dataReady = true
})
.catch(error => {
console.log(error)
this.errored = true
})
.finally(() => this.loading = false)
}
},
I ensure that the front-end is only rendered once the data is ready.
Is there a way to resolve this issue?
Thank you.