将响应对象的值分配给模型对象

时间:2019-07-07 22:40:19

标签: angular

我已经在angular中实现了一个服务方法,该方法调用asp.net webapi,该方法通过响应对象返回一个整数数组。我需要将这些值捕获为模型对象的一部分,并将其传递给另一个名为getDocumentUploadDetailsByIds的端点调用。最初,我尝试将值直接传递给端点,但在达到断点时为null。因此,我决定将数组作为数组对象的一部分传递。如何将值分配给models 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');
                });

0 个答案:

没有答案