diff --git a/src/lib/help-mode/help-mode.directive.ts b/src/lib/help-mode/help-mode.directive.ts index 59c140a..199cc64 100644 --- a/src/lib/help-mode/help-mode.directive.ts +++ b/src/lib/help-mode/help-mode.directive.ts @@ -1,4 +1,4 @@ -import { Directive, ElementRef, Input, OnInit, Renderer2 } from '@angular/core'; +import { Directive, ElementRef, Input, OnInit, Optional, Renderer2 } from '@angular/core'; import { HelpModeService, ScrollableParentView } from './help-mode.service'; import { Router } from '@angular/router'; @@ -15,14 +15,14 @@ export class HelpModeDirective implements OnInit { constructor( private readonly _elementRef: ElementRef, private readonly _renderer: Renderer2, - private readonly _helpModeService: HelpModeService, + @Optional() private readonly _helpModeService: HelpModeService, private readonly _router: Router, ) { this._path = this._router.url.split('/').pop() as string; } ngOnInit(): void { - if (this.elementName) { + if (this.elementName && this._helpModeService) { this._createHelperElement(); } } diff --git a/src/lib/listing/table-content/table-content.component.html b/src/lib/listing/table-content/table-content.component.html index 6185939..68e8083 100644 --- a/src/lib/listing/table-content/table-content.component.html +++ b/src/lib/listing/table-content/table-content.component.html @@ -14,7 +14,7 @@ (mouseenter)="itemMouseEnterFn && itemMouseEnterFn(entity)" (mouseleave)="itemMouseLeaveFn && itemMouseLeaveFn(entity)" *ngIf="itemMouseEnterFn || itemMouseLeaveFn; else withoutMouseEvents" - [class.help-mode]="helpModeService.isHelpModeActive$ | async" + [class.help-mode]="helpModeService?.isHelpModeActive$ | async" [id]="'item-' + entity.id" [ngClass]="getTableItemClasses(entity)" [routerLink]="entity.routerLink" @@ -28,7 +28,7 @@
, PrimaryK constructor( @Inject(forwardRef(() => ListingComponent)) readonly listingComponent: ListingComponent, readonly listingService: ListingService, - readonly helpModeService: HelpModeService, + @Optional() readonly helpModeService: HelpModeService, ) { super(); this.addSubscription = this.listingComponent.noContent$.subscribe(() => {