Answer the question
In order to leave comments, you need to log in
How to use $http in es6 class?
export default class ThingFactory {
constructor($http) {
this.$http = $http;
this.data = {
name: "Name",
age: 17
};
}
get() {
this.$http({
method: 'GET',
url: '/1'
}).then(function successCallback(response) {
console.log(response)
}, function errorCallback(response) {
console.log(response)
});
}
newThing() {
console.log('Getting a new Thing...');
return this.data;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question