【发布时间】:2020-02-19 16:20:19
【问题描述】:
我使用 angular 8 和 asp.net 核心,所以我想在下拉列表中按字母顺序显示客户的姓名,从 api 服务,我找到了使用 observable 的唯一解决方案。还有其他方法可以实现吗?以及如何在 observable 中使用字母排序?
getAllcustomer() {
return this._http.get<any>(this.myAppUrl + '/api/users/getcustomer', {responseType: 'json'} )
.catch(this.errorHandler);
}
谢谢
【问题讨论】:
-
Observable 出了什么问题?
-
您能提供有关响应数据的信息吗?
-
接口是http所以你总是可以在c#中使用httpRequest。我会使用像wireshark或fiddler这样的嗅探器,看看当前请求是什么样子,然后创建你自己的代码来模仿当前代码。
-
@JuliusDzidzevičius 唯一的问题是我不熟悉 Observable 并且我不知道对它使用排序
-
...seType: 'json'} ).pipe(map(res => res.sort()))。res.sort()你可能需要修改
标签: c# angular asp.net-core observable