Hi Vinu,

If you would have provided a running example, I could have tested this, but 
i guess it will work anyway, thry something like this:

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'), (lookup, data) =>
data.map(row => ({ ...row, cost: lookup.get(row.year) }))
);

constructor(private http: Http) {}

getData(): Promise<any> {
return this.smartTableData.toPromise();
}
}


Do yourself a favour, and stop using jQuery, and learn a bit more about 
Observables.

Regards
Sander

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

Reply via email to