Below is how I am initializing two static variables:
export class PrintService {
public static richTextBoxValue: string[] = [];
public static mm2pt = 2.83465;
}
In another class, I have below code:
if (isHtmlStringReceived) {
console.log(PrintService);
console.log(PrintService.richTextBoxValue);
console.log(PrintService.mm2pt);
if (!PrintService.richTextBoxValue.includes(attributeSmartValue)) {
PrintService.richTextBoxValue.push(attributeSmartValue);
}
}
I added a breakpoint in the following code PrintService.richTextBoxValue.push(attributeSmartValue);
and richTextBoxValue
value shows undefined
.
Even after executing the push
, the value is still undefined
.
I can see the correct values logged to the console through console.log()
but in the watch tab they show undefined
as shown in the picture below.
Any idea what might be causing this unexpected behavior?