angular 中的 forkjoin

2023-11-18

以下示例是关于Javascript中包含angular 中的 forkjoin用法的示例代码,想了解angular 中的 forkjoin的具体用法?angular 中的 forkjoin怎么用?angular 中的 forkjoin使用的例子?那么可以参考以下相关源代码片段来学习它的具体使用方法。

[英]:forkjoin in angular源码类型:Javascript
let transactionStatus = this.commonCodeService.getCommonCodeByCodeTypeId(CodeType.ApplicationStatus);
        let transactionType = this.commonCodeService.getCommonCodeByCodeTypeId(CodeType.TransactionType);
        let electionType = this.commonCodeService.getCommonCodeByCodeTypeId(CodeType.ElectionType);
        let premiumWithHold = this.commonCodeService.getCommonCodeByCodeTypeId(CodeType.PremiumWithHold);
        let pendReason = this.commonCodeService.getCommonCodeByCodeTypeId(CodeType.PendReason);
        let incomepleteReason = this.commonCodeService.getCommonCodeByCodeTypeId(CodeType.IncomepleteReason);
        let denialReason = this.commonCodeService.getCommonCodeByCodeTypeId(CodeType.DenialReason);
        let subGroup = this.commonCodeService.getCommonCodeByCodeTypeId(CodeType.SubGroup);
        let disenrollmentReasonCode = this.commonCodeService.getCommonCodeByCodeTypeId(CodeType.DisEnrollmentReasonCode);

        forkJoin([transactionStatus, transactionType, electionType, premiumWithHold, pendReason, incomepleteReason, denialReason, subGroup, disenrollmentReasonCode])
            .subscribe({
                next: (res) => {
                    this.transactionStatusList = res[0];
                    this.transactionTypeList = res[1];
                    this.electionTypeList = res[2];
                    this.premiumWithHoldList = res[3];
                    this.pendReasonList = res[4];
                    this.incompleteReasonList = res[5];
                    this.denialReasonList = res[6];
                    this.subGroupList = res[7];
                   }, error: (err) => {
                    this.isLoadingData = true;
                }
            });

本文地址:https://www.itbaoku.cn/snippets/876572.html