Add property to object based on another observable
<p>Hi i have two arrays that come from server and i need to assign value to 2 array based on first array;
Example in first array i have nameId of a person, based on this id i need to find real name and assign it. not sure its correct reactWay to do it;</p>

<pre><code>var names = this.nameService.query()
        .flatMap((names) =&gt; {
            return Observable.from(names);
        }).flatMap(name =&gt; {
            return Observable.combineLatest(Observable.of(name), this.nameArray, (name,nameArray) =&gt; {
                name.realName = this.nameService.getRealNamedName(name.nameId, names);
                return name;
            })
        }).toArray();


names.subscribe(names =&gt; {
 this.names = names 
})
</code></pre>

<p>EDITED: </p>

<p>with imperative programming i would write it like this</p>

<pre><code>var promises = {
            people: peopleService.getPeople(),
            names: nameService.getNames()
        };

    $q.all(promises).then(result =&gt; {
        this.people = result.people.forEach(person =&gt; {
                            person.realName = result.names.find((name) =&gt; {
                                return name.id === person.id
                            })['realName']
                         })
    })
</code></pre>