Skip to content

Commit

Permalink
[DSC-472] Replace document object with inject token
Browse files Browse the repository at this point in the history
  • Loading branch information
atarix83 committed Apr 6, 2022
1 parent 7078fd8 commit 87c9d46
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/app/shared/context-menu/context-menu.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Injector, Input, OnInit } from '@angular/core';
import { Component, Inject, Injector, Input, OnInit } from '@angular/core';

import { select, Store } from '@ngrx/store';
import { from, Observable } from 'rxjs';
Expand All @@ -17,6 +17,7 @@ import { ContextMenuEntryType } from './context-menu-entry-type';
import { isNotEmpty } from '../empty.util';
import { ConfigurationDataService } from '../../core/data/configuration-data.service';
import { GenericConstructor } from '../../core/shared/generic-constructor';
import { DOCUMENT } from '@angular/common';

/**
* This component renders a context menu for a given DSO.
Expand Down Expand Up @@ -59,11 +60,13 @@ export class ContextMenuComponent implements OnInit {
/**
* Initialize instance variables
*
* @param {Document} _document
* @param {ConfigurationDataService} configurationService
* @param {Injector} injector
* @param {Store<CoreState>} store
*/
constructor(
@Inject(DOCUMENT) private _document: Document,
private configurationService: ConfigurationDataService,
private injector: Injector,
private store: Store<CoreState>
Expand Down Expand Up @@ -133,8 +136,8 @@ export class ContextMenuComponent implements OnInit {

ngAfterViewChecked() {
// To check that Context-menu contains options or not
if (document.getElementById('itemOptionsDropdownMenu')) {
const el = Array.from(document.getElementById('itemOptionsDropdownMenu')?.getElementsByClassName('ng-star-inserted'));
if (this._document.getElementById('itemOptionsDropdownMenu')) {
const el = Array.from(this._document.getElementById('itemOptionsDropdownMenu')?.getElementsByClassName('ng-star-inserted'));
this.optionCount = 0;
if (el) {
el.forEach(element => {
Expand Down

0 comments on commit 87c9d46

Please sign in to comment.