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

73
Views
Modal js a Angular

Necesito ayuda con esto:

Intento usar modal js en angular sin ninguna otra biblioteca, este es el código original:

 var modalBtns = [...document.querySelectorAll(".preview")]; modalBtns.forEach(function(btn){ btn.onclick = function() { var modal = btn.getAttribute('data-modal'); document.getElementById(modal).style.display = "block"; } }); var closeBtns = [...document.querySelectorAll(".modal-close")]; closeBtns.forEach(function(btn){ btn.onclick = function() { var modal = btn.closest('.modal'); modal.style.display = "none"; } }); window.onclick = function(event) { if (event.target.className === "modal") { event.target.style.display = "none"; } }

Traté de usar viewchild pero no pude hacerlo funcionar, ¿cómo debo hacerlo?

(este es mi código html)

 <article *ngFor="let user of users" class="post-user"> <img class="preview" data-modal="modal" src="{{user.img}}"> <div class="m-details"> <h3>{{user.name}} <span>– {{user.lastname}}</span> </h3> <p>{{user.desc}}</p> </div> <div id="modal" class="modal"> <div class="post-container"> <span class="modal-close">&times;</span> <div class="post-header"> <h2 class="title-02">Title</h2> </div> <div class="post-content"> <img class="post-img" src="{{user.img}}"> <div class="user-description"> <div class="post-data"><span class="bold nameB">Title </span><span class="pName01">{{user.name}}</span></div> <div class="post-data"><span class="bold descB">Desc: </span><p class="pDesc01">{{user.desc}}</p></div> </div> </div> </div> </div> </article>
about 4 years ago · Juan Pablo Isaza
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!