I have a very simple class like:
export class Party {
constructor(
public id:Identifier,
public partyName: PartyName,
public person:Person
) { }
copy():Party {
let copyParty = new Party(this.id, null, null);
return copyParty;
}
}
I want to use the copy function (or method?) in another class (specifically a service) importing this class like:
... (party => {
let copyParty:Party = party.copy();
...
But I get the following exception:
EXCEPTION: Uncaught (in promise): TypeError: party.copy is not a function
I tried let copyParty:Party = Function.call(party.copy, copy) (got some exceptions) as well as let copyParty:Party = party.copy; (returns the function definition, not the copied the object).
What am I missing here? Thanks.