Javascript 当进行服务调用以访问不同数据时,如何更改按钮文本值?

Javascript 当进行服务调用以访问不同数据时,如何更改按钮文本值?,javascript,html,angular,Javascript,Html,Angular,我有一个文件 secondary.check.html <div class="card"> <div class="navbar navbar-default"> <h5 style="margin: auto; font-size:15px; font-family:Verdana, Geneva, Tahoma, sans-serif;">Secondary Iata

我有一个文件 secondary.check.html

<div class="card">
    <div class="navbar navbar-default">
        <h5 style="margin: auto;  font-size:15px; font-family:Verdana, Geneva, Tahoma, sans-serif;">Secondary Iata Check</h5>

 </div>
    <div class="container">
        <button class="export"  data-toggle="modal" data-target="#exampleModalCenterSecondary " 
        style="margin-top:15%;margin-left:28%;font-size: 45px; font-weight: 400;font-family: amadeus;font-style: normal; color:#005eb8;">{{primaryCount}}</button>
        <div class="modal" id="exampleModalCenterSecondary" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
            <div class="modal-dialog-valid">
                <div class="modal-content">
                    <div class="modal-header">
                        <h6 class="modal-title" style="margin-left: 44%;margin-top: 10px;">Secondary Iata Check</h6>
                        <button type="button"class="btn btn-outline-info" (click)="results_valid()" ><img src="https://img.icons8.com/ios/50/000000/export-csv.png" width="30" height="30"/></button>
                      <button type="button" class="close" data-dismiss="modal"onclick="{$('#exampleModalCenterSecondary').hide()}">&times;</button>
                    </div>
                    <div class="modal-body">
                        <div id="divValidSecondaryChart"style="height:500px;text-align:center"></div>
                    </div>
                    <div class="modal-footer">
                        <div id='png'></div>
                    </div>
                </div>
            </div>
        </div>
             </div>
    </div>


现在出现的问题是,每当数据被更改时,就要求angular服务调用不同组织的数据。按钮值保持不变。例如,对于AOM Qa,我寻求显示的按钮值应为2,对于2X,应为3,并且我已将默认orga设置为AOM-Qa本身。在更改数据和不更改数据的情况下,我得到的输出仅为2。如果有人能调查这个问题,并让我知道如何做按钮值可以改变每个组织。从下拉菜单中选择

import { Component, OnInit } from '@angular/core';
import {GoogleChartService} from '../service/google-chart.service';
import {SystemValueService} from '../../shared/system-value.service';

import {HttpClient} from '@angular/common/http';
import { viewClassName } from '@angular/compiler';
import { ngxCsv } from 'ngx-csv/ngx-csv';
import { ObjectQuerySelector } from 'mongodb';
import { modelNames } from 'mongoose';
import * as $ from 'jquery';
import { copyFileSync } from 'node:fs';
import { count } from 'rxjs/operators';
import { Button } from 'bootstrap';

@Component({
  selector: 'app-secondary-check-iata',
  templateUrl: './secondary-check-iata.component.html',
  styleUrls: ['./secondary-check-iata.component.css']
})
export class SecondaryCheckIataComponent implements OnInit {
  private gLib:any;
  public fig1:any;
 public fig2:any;
 public primaryCount:any;
 public secondaryCount:any;
 public flag=false;
 async ngOnInit() {
    this.fig1=await this.systemvalueService.getSystemValue('AOM-QA').toPromise();
    this.fig2=await this.systemvalueService.getSystemValue('2X').toPromise();
 this.primaryCount= this.drawChart();   
}
    
     async  refreshData(orga:string)
     
{    
     this.fig1=await this.systemvalueService.getSystemValue(orga).toPromise();
     if(orga=='AOM-QA')
     {
       this.fig2=await this.systemvalueService.getSystemValue('2X').toPromise();
     }
     else if(orga=='2X')
     {
      this.fig2=await this.systemvalueService.getSystemValue('AOM-QA').toPromise();
     }
     this.primaryCount=this.drawChart();
  }
          constructor(private gChartService:GoogleChartService,private http:HttpClient,public systemvalueService:SystemValueService)
          {
            this.gLib=this.gChartService.getGoogle();
            this.gLib.charts.load('current',{'packages':['corechart','table']});
            // this.gLib.charts.setOnLoadCallback(drawToolTipCharts);
      }
      
    private localList()
    {
      let data =this.fig1;
      var locallist=[['object_id','label','amid','office_code','office_value']];
      var j=0;
      while(data[j]!=null)
      {
        if(data[j].office_code=='CIN')
        {
          locallist.push([data[j].object_id.toString(),data[j].label,data[j].amid.toString(),data[j].office_code,data[j].office_value]);
        }
        j++;
      }
      return locallist;
    }
    private foreignList()
    {
      let data =this.fig2;
      var foreignlist=[['object_id','label','amid','office_code','office_value']];
      var j=0;
      while(data[j]!=null)
      {
        if(data[j].office_code=='CIN')
        {
          foreignlist.push([data[j].object_id.toString(),data[j].label,data[j].amid.toString(),data[j].office_code,data[j].office_value]);
        }
        j++;
      }
      return foreignlist;
    }
    private secondarycheck(locallist:string[][],foreignlist:string[][])
    {
      var j=1;
      var count=0;
      var validDatalist=[['object_id','label','amid','office_code','office_value']];
      while(locallist[j]!=null)
      {
        let cin_value=locallist[j][4];
        let iata_value=cin_value.substring(0,7);
        let indicator='';
        let isPrimary = cin_value.indexOf("PRIMARY") != -1 ? true : false;
        if(isPrimary==true)
        {
          for(var k=1;foreignlist[k]!=null;k++)
          {
            let cin_foreign=foreignlist[k][4];
            let iata_foreign=cin_foreign.substring(0,7);
            if(iata_foreign==iata_value)
            {
              let isSecondary=cin_foreign.indexOf("SECONDARY")!=-1?true:false;
              if(isSecondary==true)
              {
                validDatalist.push(locallist[j]);
              }
            }
          }
        }
        j++;
      }
     return validDatalist;
    }
    public drawChart()
    {
      let locallist=this.localList();
      let foreignlist=this.foreignList();
      let validDatalist=this.secondarycheck(locallist,foreignlist);
      let count=validDatalist.length-1;
      let chart_valid=new this.gLib.visualization.Table(document.getElementById('divValidSecondaryChart'));
      let figures_valid =new this.gLib.visualization.arrayToDataTable(validDatalist);
       var options_valid = {
           width:1000,
           height:500,
           legend:true,
           theme:'material'
       };
       chart_valid.draw(figures_valid, options_valid); 
      return count;
    }
    results_valid()
    {
      let locallist=this.localList();
      let foreignlist=this.foreignList();
      let validDatalist=this.secondarycheck(locallist,foreignlist);
      new ngxCsv(validDatalist, 'Secondary Check Values');
    }
}
function getElementById(arg0: string) {
  throw new Error('Function not implemented.');
}