I'm working on a small project using Laravel and Vuejs everything is okey with me i loved this two frameworks. i have just a small error when i try to access to goToStep function using jQuery $.each.
By the way jQuery is already included and works fine. the only problem is i can't access to goToStep inside $.each.
Error Message :
Uncaught (in promise) TypeError: this.goToStep is not a function
My VuejS code :
store: function () {
axios.post("/apartment/", $("form#add-apartment").serialize()).then((response) => {
this.buildings = response.data.buildings;
alert(response.message)
}).catch(error => {
//console.log(error.response.data.errors)
$.each(error.response.data.errors, function(key, value){
var x = $("[name='"+ key +"']").closest("#parent").data('step');
this.goToStep(x)
});
});
},
goToStep: function (value) {
if (!this.validate()) {
return;
}
this.current_step = value;
},