Skip to content

Commit

Permalink
refactor(module:icon): component factory is no longer needed (#8074)
Browse files Browse the repository at this point in the history
  • Loading branch information
HyperLife1119 authored Sep 18, 2023
1 parent a9d34f5 commit b42cb09
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions components/icon/page/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,7 @@
*/

import { DOCUMENT } from '@angular/common';
import {
Component,
Inject,
OnDestroy,
OnInit,
ComponentFactoryResolver,
Input,
ViewChild,
TemplateRef,
ViewContainerRef
} from '@angular/core';
import { Component, Inject, Input, OnDestroy, OnInit, TemplateRef, ViewChild, ViewContainerRef } from '@angular/core';
import { of, Subscription } from 'rxjs';

import { manifest, ThemeType } from '@ant-design/icons-angular';
Expand Down Expand Up @@ -557,8 +547,7 @@ export class NzPageDemoIconComponent implements OnInit, OnDestroy {

private getCopiedStringTemplateRef(copiedString: string): TemplateRef<void> {
this.viewContainerRef.clear();
const factory = this.componentFactoryResolver.resolveComponentFactory(NzPageDemoIconCopiedCodeComponent);
const componentRef = this.viewContainerRef.createComponent(factory);
const componentRef = this.viewContainerRef.createComponent(NzPageDemoIconCopiedCodeComponent);
componentRef.instance.copiedCode = copiedString;

return componentRef.instance.templateRef;
Expand Down Expand Up @@ -670,7 +659,6 @@ export class NzPageDemoIconComponent implements OnInit, OnDestroy {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@Inject(DOCUMENT) private dom: any,
private _iconService: NzIconService,
private componentFactoryResolver: ComponentFactoryResolver,
private message: NzMessageService,
private viewContainerRef: ViewContainerRef
) {
Expand Down

0 comments on commit b42cb09

Please sign in to comment.