I am trying to bind a variable which contains the date and time to a key value pair within Component A. I can see in the console the value of currentDate, but when I try to bind the variable to the value of key = currDate I get an error message stating that the variable is undefined.
Essentially, I would want to replace the part where it says undefined with something like Friday May 21 11:38:19
Component A - ComponentA.ts
import { Component, HostListener } from '@angular/core';
import { service } from '../../..common/service';
... Some Code...
@Component({
selector: 'ComponentA',
styleUrls: ['./ComponentA.css'],
templateUrl: './ComponentA.html'
})
export class ComponentA {
... Some Code ...
currentDate: any;
plotDesc: { [key:string]: string } = {
currDate: `The number of open requests since <div *ngIf="currentDate">${this.currentDate.data.date}</div>`
};
constructor(private sw: Service){ }
... Rest of Code ...



currentDate? As i can see on your code is you are using undefined property as an object. Also console seams to talk about promise but your code does not seams to point any Promise. You should consider adding stackblitz.com...Some code..., ideally something reproducible.currentDateis an object that feeds data from a list of systems doing so by subscribing and saving the data in the from of a JSON response.currentDate.data.datecontains the date/time data that I need. I have several methods that take care of this.