My CodePen below is a working example of what should be happening. Everything there is working as expected. I am using hard coded data there.
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:
When I replace the hard coded data with an AXIOS get call, the CodePen checkboxes do not function as expected. The All checkbox is correctly checked, however the rest are not.
I'm assuming, the slight delay in loading the API is the cause of this.
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 do not load the front-end until the data is ready.
How can I remedy this issue?
Thanks.