Browse Source
Merge pull request #15123 from abpframework/remove-deprecated-create-comp-on-replaceble-component
Replace deprecated create component function
pull/15126/head
Muhammed Altuğ
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
5 additions and
7 deletions
-
npm/ng-packs/packages/core/src/lib/directives/replaceable-template.directive.ts
|
|
|
@ -1,5 +1,5 @@ |
|
|
|
import { |
|
|
|
ComponentFactoryResolver, |
|
|
|
ComponentRef, |
|
|
|
Directive, |
|
|
|
Injector, |
|
|
|
Input, |
|
|
|
@ -44,7 +44,6 @@ export class ReplaceableTemplateDirective implements OnInit, OnChanges { |
|
|
|
constructor( |
|
|
|
private injector: Injector, |
|
|
|
private templateRef: TemplateRef<any>, |
|
|
|
private cfRes: ComponentFactoryResolver, |
|
|
|
private vcRef: ViewContainerRef, |
|
|
|
private replaceableComponents: ReplaceableComponentsService, |
|
|
|
private subscription: SubscriptionService, |
|
|
|
@ -83,11 +82,10 @@ export class ReplaceableTemplateDirective implements OnInit, OnChanges { |
|
|
|
providers: [{ provide: 'REPLACEABLE_DATA', useValue: this.providedData }], |
|
|
|
parent: this.injector, |
|
|
|
}); |
|
|
|
this.vcRef.createComponent( |
|
|
|
this.cfRes.resolveComponentFactory(res.component), |
|
|
|
0, |
|
|
|
customInjector, |
|
|
|
); |
|
|
|
const ref = this.vcRef.createComponent(res.component, { |
|
|
|
index: 0, |
|
|
|
injector: customInjector, |
|
|
|
}); |
|
|
|
} else { |
|
|
|
this.vcRef.createEmbeddedView(this.templateRef, this.context); |
|
|
|
} |
|
|
|
|