angular - 将响应对象的值分配给模型对象
问题描述
我在 Angular 中实现了一个服务方法,它调用 asp.net webapi,它通过响应对象返回一个整数数组。我需要将这些值作为模型对象的一部分捕获,并将其传递给另一个名为 getDocumentUploadDetailsByIds 的端点调用。我最初尝试将值直接传递到我的端点,但在到达断点时它为空。所以我决定将数组作为数组对象的一部分传递。如何将值分配给模型 ids 数组。有人可以告诉我如何实现这一目标。
export interface IDocumentIds {
ids: number[];
}
documentIds: IDocumentIds;
this.documentUploadService.createDocumentUpload(this.documents)
.then((result) => {
if (result) {
//this.documentIds.ids = result;
this.getDocumentUploadDetailsByIds(result);
this.setGridOptions();
this.setColumns();
this.notify.success('Documents uploaded Successfully');
}
}).catch(err => {
this.notify.error('An Error Has Occured While uploading the documents');
});
解决方案
推荐阅读
- spring - Spring Boot + Mongo - com.mongodb.BasicDocument,您不能添加第二个“id”标准
- elixir - Enum.filter 除了一个元素
- scala - Flink 可以为单个表/窗口处理约 50 GB 的状态吗?
- jmeter - 如何将从 Chrome 导出的 .HAR 文件导入 JMeter?
- flutter - 如何缓存手机联系人?
- c# - 从服务器接收结果时发生传输级错误错误 C#
- sql - 为什么我在运行此代码时收到“无效标识符”oracle 错误?
- python - Python 词云 - TypeError:预期的字符串
- python - Pycharm 内联文档不适用于 Macbook 中的 python 3.7
- flutter - Flutter - 使用 pushName 获取数据