Angular RxJS Map

In this example, we want to get individual property values from an API call. For instance, calling an API to get the historical price data for a particular stock and show it in a chart. The map function can get single columns of data such as date and price.

import { map } from 'rxjs/operators';
private subs = new Subscription(); this.subs.add(this.fmpService.getHistoricalStockData(tickerSymbol) .subscribe((result) => { let price = result['data'].map(data => data.Price); let historicalDate = result['data'].map(data => data.Date);


If the the code above does not won’t work, then try the following

import 'rxjs/add/operator/map';

private subs = new Subscription();
private resultData: any;

this.subs.add(this.fmpService.getHistoricalStockData().subscribe((data) => {
      this.resultData =;
      this.options = => data.Country);