Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

164
Vistas
modify Observable in Angular and return new Observable with made changes

I have a this Observable

obs1$ = this.otherService.getObservable() which is of type number

I want to create a method which emits a Observable using the return value of this Observable


 combined() {
    this.currentLambdaReactorState$.subscribe((e) => {
      let dto = of([
        {
          name: 'foo',
          value: e,
        },
      ])
        return dto
    });
  }


so far this method does not return anything, how can I return a Observable from that method ?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Map is what you want here.

// replace any with your type (returned from currentLambdaReactorState$)
combined(): Observable<{name: string, value: any}> {
  return this.currentLambdaReactorState$.pipe(
    // shorthand object literal return
    map((e)=> ({name: 'foo', value: e})) 
  )
}

// usage
combined().subscribe((mappedValue) => {
  console.log(mappedValue); // {name: 'foo', value: e}
});
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda