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

172
Views
Espere QueryParams, Entradas y Suscripciones

Ha habido varias veces en las que he codificado soluciones seguidas de 1000 correcciones cuando en un proyecto de Angular me encuentro teniendo que escuchar varios eventos repartidos en el tiempo debido a los ciclos de vida de Angular, tiempo para ejecutar algunas funciones y todo eso para poder ejecutar una sola acción.

No sé si es posible usar las API proporcionadas por Angular e incluso RxJs para lograr mis objetivos.

Mi pregunta:

¿Cómo debería esperar la respuesta de QueryParams de una página, mientras espera algunas @inputs proporcionadas por esa página y espera la respuesta de una suscripción?

¿Es un error de diseño? ¿Hay una solución más fácil que probar todos los casos posibles?

El objetivo es realizar una acción solo cuando tengo el valor de las 2 entradas y las dos suscripciones.

Sabiendo que nunca los tendría al mismo tiempo y que el valor del servicio es independiente del ciclo de vida de Angular

 export class aComponent implements OnChanges{ @Input() anInput!: string; @Input() anotherInput!: string; private theInputValue : string; private theAnotherInputValue: string; private theServiceValue: string; private theActivatedRouteQueryParamsValue: string; constructor(private aService: ServiceType, private activatedRoute: ActivatedRoute){ // This will only be emitted when a user click on something on the user interface this.aService.something.subscribe((value) => { this.theServiceValue = value; }) this.activatedRoute.queryParams.subscribe((queryParams) => { this.theActivatedRouteQueryParamsValue = queryParams; }) // And now, when to call executeThisFunctionWhenAllClassPropertiesAreSetted() ? } // When all values are there, do an action, (Here is my question). How to know it without using a setInterval() function ? private executeThisFunctionWhenAllClassPropertiesAreSetted(): void{ // God, i learned something, thank you <3 }

}

Agradecería sus respuestas, Saludos

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!