thank You sir for your response.. I did like you said. But i have an error
*newTable.service.ts (16,44):Property 'set' does not exist on type '<T, R>(this: Observable<T>, project: (value: T, index: number) => R, thisArg?: any) => Observable...'.* what will i do ? On Thu, Sep 28, 2017 at 11:37 AM, Sander Elias <[email protected]> wrote: > Oh forgot to parse the return of the second get, here is the bug resolved: > > import { Injectable } from '@angular/core'; > import { Http, Response, Headers, RequestOptions } from '@angular/http'; > import { Observable } from 'rxjs/Rx'; > import 'rxjs/add/operator/map'; > import 'rxjs/add/operator/zip'; > import 'rxjs/add/operator/toPromise'; > @Injectable() > export class SmartTablesService { > smartTableData = this.http > .get('http://192.168.0.100:8000/json2') > .map(response => response.json()) > .map(data => > data.reduce((acc, item) => map.set(item.year, item.cost), new Map()) > ) > .zip( > this.http > .get('http://192.168.0.100:8000/json1') > .map(response => response.json()), > (lookup, data) => > data.map(row => ({ ...row, cost: lookup.get(row.year) })) > ); > > constructor(private http: Http) {} > > getData(): Promise<any> { > return this.smartTableData.toPromise(); > } > } > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Angular and AngularJS discussion" group. > To unsubscribe from this topic, visit https://groups.google.com/d/ > topic/angular/DMlviGzi-ek/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/angular. > For more options, visit https://groups.google.com/d/optout. > -- *Vinu Prasad* -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
