I need to call a method after get the data from the http post request
service: request.service.TS
get_categories(number){
this.http.post( url, body, {headers: headers, withCredentials:true})
.subscribe(
response => {
this.total = response.json();
}, error => {
}
);
}
component: categories.TS
search_categories() {
this.get_categories(1);
//I need to call a Method here after get the data from response.json() !! e.g.: send_catagories();
}
Only works if I change to:
service: request.service.TS
get_categories(number){
this.http.post( url, body, {headers: headers, withCredentials:true})
.subscribe(
response => {
this.total = response.json();
this.send_catagories(); //here works fine
}, error => {
}
);
}
But I need to call the method send_catagories()
inside of component after call this.get_categories(1);
like this
component: categories.TS
search_categories() {
this.get_categories(1);
this.send_catagories(response);
}
What I doing wrong?