I am having an issue with watched property in Vuejs. The error i am getting - Cannot read property 'list' of undefined
even though the list is defined.
I am getting the error after it does the if check (at the var index ....
line).
watch: {
selectedRole: () => {
if (this.modifiedUser.list) {
var index = this.modifiedUser.list.findIndex(obj => obj.id ==
this.selectedObj);
this.modifiedUser.list[index].object = Object.assign({}, this.selectedObj);
}
}
Any idea why it passes the check in the if statement but fails on the next line?
VueJs - v2.5.2.