0👍
✅
You need to check what type is the data
returned from the server. If @Raj’s solution didn’t resolve your issue then probably permissionID
is not present in the data
that is returned.
Do a colsole.log(data)
and check whether data
is an object
or an array
of objects
.
Cheers!
0👍
Its a common js error. Make the following changes and it will work.
fetchPermissionDetail: function (id) {
var self = this; //add this line
this.$http.get('../api/getComplaintPermission/' + id, function (data) {
self.permissionID = data.permissionID; //replace "this" with "self"
});
},
}
the reason is this
points to window
inside the anonymous function function()
This is a well known js problem. If you are using es2015 you can use arrow syntax (() => { /*code*/ }
) syntax which sets this
correctly
Source:stackexchange.com