As a newcomer, I am still learning how to phrase my questions correctly, so please be patient with me as I seek understanding. I have an object called Firms, and this is the information it contains: https://i.sstatic.net/fTZHK.png
In code, it appears like this:
export interface Firm {
name: string
fullName: string
ein: string
crn: string
email: string
email2: string
address: string
address2: string
zip: string
city: string
country: string
phone: string
phone2: string
type: string
logo: string
disabled: true
taxPayer: true
locale: string
currency: string
domain: string
}
I'm trying to figure out how to retrieve "maxIncomePerYear" or "maxIncomePer365" from the Firms object so that I can perform calculations with them. Here's what I've attempted so far:
export class InsightsComponent implements OnInit {
insights: any;
firm:Firm;
constructor(
private firmService: FirmService,
private provider: FirmProvider,
private http: HttpClient,
) {}
ngOnInit(): void {
this.provider.getInsights(this.firmService.getDomain())
.then(data => {
console.log(data);
this.insights = data;
});
this.provider.getCurrent(this.firmService.getDomain())
.then(data => {
this.firm = data;
});
}
calcInvoiced = (firm: number, insights: number) => {
return ((this.firms.maxIncomePerYear / this.insights.incomeForYear) * 100).toFixed(2);
}
}