Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

564
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda