Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

562
Views
Angular How to Trigger a Button after another button is clicked

In my code, I have two buttons. One for saving an offer and the other one for sending that offer. I want the send button to start to work if the save button is clicked one time. If the user tries to send the offer without clicking the save button at least once, a warning message should be displayed. Here is my code, how can I achieve this?

       saveOffer() {
          this._offerService.saveOffer(this.offer).subscribe(() => {
            this._offerService.getOfferDetail(this.offer.OfferId);
          });
      }
      sendOfferSupplier() {

        this.confirmDialogRef = this._dialog.open(FuseConfirmDialogComponent, {
            disableClose: false
        });

        this.confirmDialogRef.componentInstance.confirmMessage = 'Do you want to send the offer?';

        this.confirmDialogRef.afterClosed().subscribe(result => {
            if (result) {
                this.offer.ApprovementInfo.Description = result;
                this._offerService.sendOfferSupplier(this.offer).subscribe(() => {
                    this._offerService.getOfferDetail(this.offer.OfferId);
                });
            }
        });
      }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Create a bool flag and manage it to check the state:

  isOfferSaved = false;
  saveOffer() {
    this._offerService.saveOffer(this.offer).subscribe(() => {
        this._offerService.getOfferDetail(this.offer.OfferId);
        this.isOfferSaved = true;
    });
  }
    sendOfferSupplier() {

   if(!this.isOfferSaved) {
        //Show warning message with a toast component
       alert('No offer saved yet!');
       return;
    }

    this.confirmDialogRef = this._dialog.open(FuseConfirmDialogComponent, {
        disableClose: false
    });

    this.confirmDialogRef.componentInstance.confirmMessage = 'Do you want to send the offer?';

    this.confirmDialogRef.afterClosed().subscribe(result => {
        if (result) {
            this.offer.ApprovementInfo.Description = result;
            this._offerService.sendOfferSupplier(this.offer).subscribe(() => {
                this._offerService.getOfferDetail(this.offer.OfferId);
            });
        }
    });
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!