Skip to content

Commit 858ec14

Browse files
committed
fix(lib): expose component ref from cross boundary element strategy
In the same way that default element strategy exposes it via protected API. Remove component ref getter from default boundary strategy wrapper.
1 parent 0057163 commit 858ec14

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

projects/ngx-element-boundary/element-strategy/default/src/element-boundary-ng-element-strategy.ts

-5
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,6 @@ export class DefaultElementBoundaryNgElementStrategy
6565
// so we are using late initialization of stream
6666
events = maybeLateInitStream(this.defaultStrategy, 'events');
6767

68-
// Forward original `ComponentRef` from the default strategy
69-
protected get componentRef(): ComponentRef<any> | undefined {
70-
return this.getComponentRef();
71-
}
72-
7368
private options: DefaultElementBoundaryNgElementStrategyOptionsDefault;
7469

7570
constructor(

projects/ngx-element-boundary/src/lib/cross-boundary-ng-element-strategy.ts

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
import { Injector } from '@angular/core';
2-
import {
3-
NgElementStrategy,
4-
NgElementStrategyEvent,
5-
NgElementStrategyFactory,
6-
} from '@angular/elements';
7-
import { Observable, of, Subject, ReplaySubject } from 'rxjs';
8-
import { take, takeUntil, timeoutWith, switchAll } from 'rxjs/operators';
1+
import { ComponentRef, Injector } from '@angular/core';
2+
import { NgElementStrategy, NgElementStrategyFactory } from '@angular/elements';
3+
import { of, Subject } from 'rxjs';
4+
import { take, takeUntil, timeoutWith } from 'rxjs/operators';
95

106
import {
117
ElementBoundaryNgElementStrategy,
@@ -73,6 +69,11 @@ export class CrossBoundaryNgElementStrategy implements NgElementStrategy {
7369
// so we are using late initialization of stream
7470
events = maybeLateInitStream(this.baseStrategy, 'events');
7571

72+
// Get `ComponentRef` from the base strategy
73+
get componentRef(): ComponentRef<any> | undefined {
74+
return this.baseStrategy.getComponentRef();
75+
}
76+
7677
private elementBoundaryService: ElementBoundaryService = this.hookableInjector.get(
7778
ElementBoundaryService,
7879
);

0 commit comments

Comments
 (0)