我需要在从http post请求中获取数据后调用方法
service:request.service.TS
get_categories(number){
this.http.post( url, body, {headers: headers, withCredentials:true})
.subscribe(
response => {
this.total = response.json();
}, error => {
}
);
}
Run Code Online (Sandbox Code Playgroud)
组件: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();
}
Run Code Online (Sandbox Code Playgroud)
只有在我改为:
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 => {
}
);
}
Run Code Online (Sandbox Code Playgroud)
但我需要调用的方法send_catagories()调用后构件的内部this.get_categories(1);这样的
组件:categories.TS
search_categories() { …Run Code Online (Sandbox Code Playgroud)