In an Angular 2 application I need to check whether or not a chrome extension is installed. To do so Google recommends here to check for a DOM element added by the extension. I'm implementing the extension as well so it's no problem to add that element when the extension loads.
But I'm struggling with the Angular side. I have a service that handles the logic with the extension (install etc.), and I would like to implement the check there as well. Unfortunately I could not figure out how to get access to the whole DOM.
There is the injectable class ElementRef
with the property nativeElement
, but that only gives me access to the DOM element that belongs to the component. Since the element added by the extension is a direct child of body that does not work here.
Does anyone now how to get access to the whole DOM in an Angular 2 compliant way?