0
是否有可能在Angular(4.3+)中使用新的HttpClient类型检查POST(以及其他请求的类型)?官方文档(https://angular.io/guide/http#typechecking-the-response)只提到GET请求:Angular HttpClient Typechecking Post Request的Repsonse
interface ItemsResponse {
results: string[];
}
...
http.get<ItemsResponse>('/api/items').subscribe(data => {
// data is now an instance of type ItemsResponse, so you can do this:
this.results = data.results;
});
是否对其他类型的请求的相同的方式工作?