Skip to content

Commit

Permalink
fix(abc:onboarding): fix ComponentFactoryResolver (#1624)
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk authored Jul 21, 2023
1 parent 66b358f commit ae065c2
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions packages/abc/onboarding/onboarding.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ import { Directionality } from '@angular/cdk/bidi';
import { DOCUMENT } from '@angular/common';
import {
ApplicationRef,
ComponentFactoryResolver,
ComponentRef,
EmbeddedViewRef,
Inject,
Injectable,
Injector,
OnDestroy,
Optional
Optional,
createComponent
} from '@angular/core';
import { Router } from '@angular/router';
import { of, pipe, Subscription, delay, switchMap } from 'rxjs';
Expand Down Expand Up @@ -47,17 +46,17 @@ export class OnboardingService implements OnDestroy {
constructor(
private i18n: DelonLocaleService,
private appRef: ApplicationRef,
// TODO: Tracking https://github.com/angular/angular/issues/45263
private resolver: ComponentFactoryResolver,
private router: Router,
private injector: Injector,
@Inject(DOCUMENT) private doc: NzSafeAny,
private configSrv: AlainConfigService,
@Optional() private directionality: Directionality
) {}

private attach(): void {
const compRef = (this.compRef = this.resolver.resolveComponentFactory(OnboardingComponent).create(this.injector));
const compRef = createComponent(OnboardingComponent, {
environmentInjector: this.appRef.injector
});
this.compRef = compRef;
this.appRef.attachView(compRef.hostView);
const compNode = (compRef.hostView as EmbeddedViewRef<NzSafeAny>).rootNodes[0];
const doc = this._getDoc();
Expand Down

0 comments on commit ae065c2

Please sign in to comment.