GitHub

@@ -36,15 +36,17 @@ export class AngularDelegate {

3636

create(

3737

environmentInjector: EnvironmentInjector,

3838

injector: Injector,

39-

elementReferenceKey?: string

39+

elementReferenceKey?: string,

40+

customInjector?: Injector

4041

): AngularFrameworkDelegate {

4142

return new AngularFrameworkDelegate(

4243

environmentInjector,

4344

injector,

4445

this.applicationRef,

4546

this.zone,

4647

elementReferenceKey,

47-

this.config.useSetInputAPI ?? false

48+

this.config.useSetInputAPI ?? false,

49+

customInjector

4850

);

4951

}

5052

}

@@ -59,7 +61,8 @@ export class AngularFrameworkDelegate implements FrameworkDelegate {

5961

private applicationRef: ApplicationRef,

6062

private zone: NgZone,

6163

private elementReferenceKey?: string,

62-

private enableSignalsSupport?: boolean

64+

private enableSignalsSupport?: boolean,

65+

private customInjector?: Injector

6366

) {}

64676568

attachViewToDom(container: any, component: any, params?: any, cssClasses?: string[]): Promise<any> {

@@ -93,7 +96,8 @@ export class AngularFrameworkDelegate implements FrameworkDelegate {

9396

componentProps,

9497

cssClasses,

9598

this.elementReferenceKey,

96-

this.enableSignalsSupport

99+

this.enableSignalsSupport,

100+

this.customInjector

97101

);

98102

resolve(el);

99103

});

@@ -131,7 +135,8 @@ export const attachView = (

131135

params: any,

132136

cssClasses: string[] | undefined,

133137

elementReferenceKey: string | undefined,

134-

enableSignalsSupport: boolean | undefined

138+

enableSignalsSupport: boolean | undefined,

139+

customInjector?: Injector

135140

): any => {

136141

/**

137142

* Wraps the injector with a custom injector that

@@ -158,7 +163,7 @@ export const attachView = (

158163159164

const childInjector = Injector.create({

160165

providers,

161-

parent: injector,

166+

parent: customInjector ?? injector,

162167

});

163168164169

const componentRef = createComponent<any>(component, {

Read the original on github.com ↗