I have a situation where I am trying to access an instance property within a static method in my utility class. Here is an example code snippet:
export class DataUtil {
constructor(public core:CoreStructureService){
}
static fetchContact(id:string):ContactModel{
for(let contact of this.core.contactList){
if(contact.contactId == id)
return contact;
}
}
}
The issue here is that the line `this.core.contactList` inside the `for` statement is causing a compilation error since we cannot refer to instance properties within a static method using `this`. So, how can we resolve this problem?