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

225
Views
Cómo cerrar el div seleccionado cuando hacemos clic en el botón

En mi aplicación angular, tengo un área de texto y dentro de la ventana emergente y cuando ingresamos cualquier dato en el área de texto, se mostrará en algún div.

.componente.html

 <div class="form-group popover-form" > <label>Enter Custom Trigger Habit: When I</label> <textarea class="form-control" [(ngModel)]="Trigger" name="Trigger"></textarea> </div> <!-- the entered data of textarea will display in below code--> <div class="col-sm-5 " > <div class="content-text" > <p>{{Trigger}}</p> </div> </div> <button type="button"><i class="icon icon-close" type="button" aria-hidden="true"></i></button>

y tengo el botón de cerrar y mi requisito es cerrar el div cuando hacemos clic en el botón de cerrar.

¿Alguien puede ayudarme en eso mismo?

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

Puede crear un indicador booleano para verificar cuándo mostrar u ocultar el div y luego crear un controlador de eventos de clic en su botón para configurar ese booleano showDiv en falso para ocultar ese div;

Por ejemplo:

 showDiv: boolean = true; closeDiv() : void { this.showDiv = false; }
 <div class="col-sm-5 " *ngIf="showDiv"> <div class="content-text" > <p>{{Trigger}}</p> </div> </div> <button (click)="closeDiv()" type="button"> <i class="icon icon-close" type="button" aria-hidden="true"></i> </button>
about 4 years ago · Juan Pablo Isaza Report

0

Puedes usar *ngIf

Modelo:
 <div *ngIf="display">Test Data</div> <input type="button" value="click" (click)="update"/>
Componente:
 display = true; update(){ this.display = !this.display; }
about 4 years ago · Juan Pablo Isaza Report

0

Puedes hacer esto usando JavaScript como este. al hacer clic, no mostrará ninguno. esto es solo un ejemplo

 function show() { var x = document.getElementById("tabi") x.style.display = "none" }
 <div class="form-group popover-form" > <label>Enter Custom Trigger Habit: When I</label> <textarea class="form-control" [(ngModel)]="Trigger" name="Trigger"></textarea> </div> <!-- the entered data of textarea will display in below code--> <div class="col-sm-5 " id='tabi' > <div class="content-text" > <p>{{Trigger}}</p> </div> </div> <button type="button" onclick="show()"><i class="icon icon-close" type="button" aria-hidden="true">Button</i></button>

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!