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>Anteponga su variable con estática.
export class getVariable { static myVariable: number = 0; }