@SailorLuvBoat: Yes, as per your comment, the problem lies with the assumption that currentMessage
is an AddressMailingData
instance - it isn't!
It is a plain javascript object, with (probably) all the same properties as AddressMailingData
, but without any of the methods.
You will need to instantiate a new AddressMailingData
object, then copy all of the property values from currentMessage
into it. You could use the javascript method Object.assign to do this simply.
You could change your AddressMailingData constructor to this:
export class AddressMailingData {
constructor(data?: any) {
Object.assign(this, data);
}
And then your subscription handler to this:
this.addressMailingStandardService.currentMessage.subscribe(currentMessage => {
this.addressStandardMessage = new AddressMailingData(currentMessage);
...
});
Then this.addressStandardMessage
will contain a valid AddressMailingData
instance, and you will be able to access your .getValidateAddressLine()
method.