Hello, I am working in universal Angular and I have the following function
private validateBox() {
const divHeight: any = document.getElementById('product-detail-images').getBoundingClientRect();
if (divHeight) {
if (divHeight.top > -2491) {
this.isAbsolute = false;
this.cd.markForCheck();
} else {
this.isAbsolute = true;
this.cd.markForCheck();
}
}
}
The problem is that document.getElementById('product-detail-images').getBoundingClientRect()
it gives me an error in the console. error TS2531: Object is possibly 'null'.