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

223
Views
importar variable de número de .ts a html <script>

Quiero exportar la variable 'myVariable' de getVariable.ts

 export class getVariable { myVariable: number = 0; }

Y utilícelo en mi html para mostrar un botón o no: intenté importar el .ts pero no hay valor en la variable 'myVariable'. ¿Cómo puedo importar la variable?

 <button type="button" id="btn1" class ="btn1"> btn1 </button> <button type="button" id="btn2" class="btn2"> btn2 </button> <script> import {getVariable } from "../getVariable "; var statement = getVariable.myVariable; if (statement != 0) { document.write('<button type="button" id="btn3" class="btn3"> btn3 </button>'); } </script>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Anteponga su variable con estática.

 export class getVariable { static myVariable: number = 0; }
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!