Here is the object structure that I am working with:
export class HourPerMonth {
constructor(
public year_month: string,
public hours: string,
public amount: string
) { };
}
My goal is to extract only the hours from this object and store them in an array.
private hourPerMonth: HourPerMonth[];
private hoursArray: Array<any>;
getChartData() {
this.chartService.getHoursPerMonth().subscribe(source => {
this.hourPerMonth = source;
this.hoursArray = ?
});
}
Any suggestions on how to achieve extracting the hours from the object into the hoursArray?