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
parent
commit
4182041e87
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      npm/ng-packs/packages/core/src/lib/directives/replaceable-template.directive.ts

12
npm/ng-packs/packages/core/src/lib/directives/replaceable-template.directive.ts

@ -1,5 +1,5 @@
import { import {
ComponentFactoryResolver, ComponentRef,
Directive, Directive,
Injector, Injector,
Input, Input,
@ -44,7 +44,6 @@ export class ReplaceableTemplateDirective implements OnInit, OnChanges {
constructor( constructor(
private injector: Injector, private injector: Injector,
private templateRef: TemplateRef<any>, private templateRef: TemplateRef<any>,
private cfRes: ComponentFactoryResolver,
private vcRef: ViewContainerRef, private vcRef: ViewContainerRef,
private replaceableComponents: ReplaceableComponentsService, private replaceableComponents: ReplaceableComponentsService,
private subscription: SubscriptionService, private subscription: SubscriptionService,
@ -83,11 +82,10 @@ export class ReplaceableTemplateDirective implements OnInit, OnChanges {
providers: [{ provide: 'REPLACEABLE_DATA', useValue: this.providedData }], providers: [{ provide: 'REPLACEABLE_DATA', useValue: this.providedData }],
parent: this.injector, parent: this.injector,
}); });
this.vcRef.createComponent( const ref = this.vcRef.createComponent(res.component, {
this.cfRes.resolveComponentFactory(res.component), index: 0,
0, injector: customInjector,
customInjector, });
);
} else { } else {
this.vcRef.createEmbeddedView(this.templateRef, this.context); this.vcRef.createEmbeddedView(this.templateRef, this.context);
} }

Loading…
Cancel
Save