Having trouble accessing data from a JSON object called "Devices" returned from a web API using Angular 2 observables.
Here is the data structure shown in the console: https://i.sstatic.net/QrhjZ.png
When using a .json file without the 'Devices' wrapper, everything works fine...
If I fetch a .json file directly, it displays well
private _productUrl = 'api/devices/devices.json';
However, with this observable code, I am unsure how to incorporate the '.Devices'
private _productUrl = 'http://localhost:42822/api/device';
constructor(private _http: Http) { }
getProducts(): Observable<IDevice[]> {//Observable<IProduct[]> {
return this._http.get(this._productUrl)
.map((response: Response) => <IDevice[]>response.json())
.do(data => console.log("All: " + JSON.stringify(data)))
.catch(this.handleError);
}