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

101
Views
objeto de teatro angular como una cuerda

Estoy siguiendo este tutorial: https://www.tutorialesprogramacionya.com/angularya/detalleconcepto.php?punto=89&codigo=89&inicio=80 . y tiene la siguiente parte de código:

 import { Component } from '@angular/core'; import { FormGroup, FormControl } from '@angular/forms'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { conversion!: string; potenciaNumero!: number; cantidad!: number; formularioConversion = new FormGroup({ numerodecimal: new FormControl(''), base: new FormControl('octal'), potencia: new FormControl('2'), largo: new FormControl(true) }); submit() { if (this.formularioConversion.value.base == "hexadecimal") this.conversion = parseInt(this.formularioConversion.value.numerodecimal).toString(16); if (this.formularioConversion.value.base == "octal") this.conversion = parseInt(this.formularioConversion.value.numerodecimal).toString(8); this.potenciaNumero = Math.pow(parseInt(this.formularioConversion.value.numerodecimal?), parseInt(this.formularioConversion.value.potencia)); if (this.formularioConversion.value.largo) this.cantidad = this.formularioConversion.value.numerodecimal.length; } }

el problema es que en la función de envío tengo la variable "numerodecimal" que está definida como un objeto pero amenazada como una cadena. ¿Cómo puedo solucionar este error?

ingrese la descripción de la imagen aquí

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

0

Puedes usar el encasillamiento para superar esto. Aquí hay algunas opciones en orden de preferencia

parseInt(this.formulatrioConversion.value.numerodecimal || "")

parseInt(this.formulatrioConversion.value.numerodecimal as string)

parseInt(this.formulatrioConversion.value.numerodecimal as any)

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!