From 90f40fda1ffd8eaa4dea2deff4dfbd4c53eab3bf Mon Sep 17 00:00:00 2001 From: cipchk Date: Mon, 1 Jul 2024 15:58:03 +0800 Subject: [PATCH] fix(abc:st): fix optional use context menu - close https://github.com/ng-alain/ng-alain/issues/2479 --- packages/abc/st/st.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/abc/st/st.component.ts b/packages/abc/st/st.component.ts index c7768cbf7..612825b83 100644 --- a/packages/abc/st/st.component.ts +++ b/packages/abc/st/st.component.ts @@ -102,7 +102,7 @@ export class STComponent implements AfterViewInit, OnChanges { private readonly columnSource = inject(STColumnSource); private readonly dataSource = inject(STDataSource); private readonly delonI18n = inject(DelonLocaleService); - private readonly cms = inject(NzContextMenuService); + private readonly cms = inject(NzContextMenuService, { optional: true }); private readonly destroy$ = inject(DestroyRef); private totalTpl = ``; @@ -798,7 +798,7 @@ export class STComponent implements AfterViewInit, OnChanges { return i; }); this.cdr.detectChanges(); - this.cms.create(event, this.contextmenuTpl); + this.cms?.create(event, this.contextmenuTpl); }); } // #endregion