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

163
Views
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 answers
Answer question

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 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!