1- import { Component , Injector , Input , OnInit } from '@angular/core' ;
1+ import { Component , Inject , Injector , Input , OnInit } from '@angular/core' ;
22
33import { select , Store } from '@ngrx/store' ;
44import { from , Observable } from 'rxjs' ;
@@ -17,6 +17,7 @@ import { ContextMenuEntryType } from './context-menu-entry-type';
1717import { isNotEmpty } from '../empty.util' ;
1818import { ConfigurationDataService } from '../../core/data/configuration-data.service' ;
1919import { GenericConstructor } from '../../core/shared/generic-constructor' ;
20+ import { DOCUMENT } from '@angular/common' ;
2021
2122/**
2223 * This component renders a context menu for a given DSO.
@@ -59,11 +60,13 @@ export class ContextMenuComponent implements OnInit {
5960 /**
6061 * Initialize instance variables
6162 *
63+ * @param {Document } _document
6264 * @param {ConfigurationDataService } configurationService
6365 * @param {Injector } injector
6466 * @param {Store<CoreState> } store
6567 */
6668 constructor (
69+ @Inject ( DOCUMENT ) private _document : Document ,
6770 private configurationService : ConfigurationDataService ,
6871 private injector : Injector ,
6972 private store : Store < CoreState >
@@ -133,8 +136,8 @@ export class ContextMenuComponent implements OnInit {
133136
134137 ngAfterViewChecked ( ) {
135138 // To check that Context-menu contains options or not
136- if ( document . getElementById ( 'itemOptionsDropdownMenu' ) ) {
137- const el = Array . from ( document . getElementById ( 'itemOptionsDropdownMenu' ) ?. getElementsByClassName ( 'ng-star-inserted' ) ) ;
139+ if ( this . _document . getElementById ( 'itemOptionsDropdownMenu' ) ) {
140+ const el = Array . from ( this . _document . getElementById ( 'itemOptionsDropdownMenu' ) ?. getElementsByClassName ( 'ng-star-inserted' ) ) ;
138141 this . optionCount = 0 ;
139142 if ( el ) {
140143 el . forEach ( element => {
0 commit comments