Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

563
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda