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

300
Views
Estoy tratando de calcular el ancho de mi div en Angular NgStyle con 2 variables con diferentes unidades

Estoy tratando de hacer un ancho: calc() pero quiero hacer una sustracción de 2 variables con diferentes unidades pero no muestra el resultado esperado.

 [ngStyle]="{ 'width': calc(notHedgedProgress + '%' - newPositionX + 'px') }"

NotHedgedProgress y NewPositionX son números

como puede ver, estoy tratando de restar una variable de unidad '%' con una 'px'.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Sus variables deben interpolarse y la regla de estilo debe tener la forma de una cadena:

 [ngStyle]="{ 'width': 'calc(' + notHedgedProgress + '% - ' + newPositionX + 'px)' }"
over 4 years ago · Santiago Trujillo 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!