this.$http.get - TypeError: Cannot read property 'get' of..
Hello there,
I get the following error in the "this. $ http.get" statements below.
Error Message :
[Vue warn]: Error in created hook: "TypeError: Cannot read property 'get' of undefined"
found in
---> at resources/js/components/employee/ViewComponent.vue
Vue Code :
export default {
data(){
return{
id:this.$route.params.id,
employee:{}
}
},
methods:{
getEmployee(){
this.$http.get('http://vue-laravel.test/employee-get-by-id/'+this.id).then(function (response) {
console.log(response);
});
}
},
created() {
this.getEmployee();
}
}
As you said I used axios I had no problem thank you.
Please or to participate in this conversation.