Angular: Property 'xxx' does not exist on type 'Window & typeof globalThis'
I am receiving an issue with my added Trustbox component ts file in the command line after serving my app.
"Property 'Trustpilot' does not exist on type 'Window & typeof globalThis'."
I have tried to declare the window and searched far and wide for a solution to this but for the life of me can not figure it out.
Here is the trustbox.component.ts code
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-trustbox',
templateUrl: './trustbox.component.html',
})
export class TrustboxComponent implements OnInit {
constructor() {}
ngOnInit() {
const trustboxRef = document.getElementById('trustbox');
window.Trustpilot.loadFromElement(trustboxRef);
}
}
According to Trustpilot article (https://support.trustpilot.com/hc/en-us/articles/115011421468--Add-a-TrustBox-widget-to-a-single-page-application) to get their widget working on a SPA you must
- Implement OnInit.
- Get a reference to the element that we pasted previously.
- Call the loadFromElement function.
I know this is something probably very simple but it is extremely annoying as I can't compile my application. Any help is very much appreciated. Thanks in advance!
from Recent Questions - Stack Overflow https://ift.tt/34vSvJL
https://ift.tt/eA8V8J
Comments
Post a Comment