title: Enable/ disable a button in Client when an event on server is finished
body: <p>I am developing a .Net core project with Angular on Frontend and c# on backend. I am new to web development and i am looking for ideas or little help on achieving a task.</p>
  
  <p>I am connecting my Angular frontend to an External server using .net web server. I am able to post data to External server successfully using Http services. After i receive response from external server the results are queued in my controller. Before i send response to client i want to enable a download button on Client, only if i receive response from the External server and the results are queued in my controller successfully. If there is no response from External server I do not want to enable download button.</p>
  
  <p>Appcomponent.html</p>
  
  <pre><code> &lt;button mat-button id="getdoc" (click) = "getdoc()" [disabled] = "disabled" &gt;Download&lt;/button&gt;
  </code></pre>
  
  <p>Appcomponent.ts</p>
  
  <pre><code>  getdoc() {
      this.download.downloadDoc()
        .subscribe(res =&gt; {
          this.datadownload = new Blob([res], { type: 'application/txt' });
        //  { this.disabled = false };
           saveAs(this.datadownload);
          console.log(this.datadownload);
        }, error =&gt; {
          console.log('error while downloading', error)
        })
  }
  </code></pre>
  
  <p>Appservice.ts</p>
  
  <pre><code>export class DownloadService {
  
    constructor(private http: HttpClient) { }
  
    downloadDoc(): Observable&lt;any&gt; {
      return this.http.get('URL', {/* headers, */ reportProgress: true, responseType : "blob"});
    }
  }
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code>namespace ang.Controllers
  {
  
      [Route("api/[controller]/[action]")]
      [ApiController]
      public class DoController : Controller
      {
   private void OnProvideData(DataAndHeader dat)
          {
  
              CommHeader header = (CommHeader)dat.Header;
  
              switch (header.Type)
              {
                  case  CommHelpers.CommType.ServerToClientReceived:                    
                      break;
                  case CommHelpers.CommType.ServerToClientFinished:
  
  
                      string ClientID = header.ClientID;
                      ConcurrentQueue&lt;DataAndHeader&gt; queueResultsForClient = null;
                      if (!dicResults.TryGetValue(ClientID, out queueResultsForClient))
                      {
                          queueResultsForClient = new ConcurrentQueue&lt;DataAndHeader&gt;();
                          if (!dicResults.TryAdd(ClientID, queueResultsForClient))
                          {
  
                          }
                      }
                      queueResultsForClient.Enqueue(dat);
                      break;
              }               
          }
  
   [HttpGet]
        // [Route("download")]
        public byte[]  download(string ClientID)
        {
  
             // some logic
              return new byte[0];
  
        }
  }
  }
  </code></pre>
  
  <p>I want to wait till i get the Response from the External Server and loaded into my Controller after that i want to enable the button. After the button is enabled and clicked by Client he should be able to download file.</p>
  
  <p>The "getdoc()" works only when i click download button. but initially the download button is in disable state. I want to programatically enable it from my controller not from my Client</p>
  
  <p>Thanks in Advance.</p>