compartido
estadísticas
@Directive({ selector: '[derFilterRef]' }) export class FilterRefDirective { constructor(public containerRef: ViewContainerRef) {} } <ng-template derFilterRef></ng-template> @Component({ selector: 'stats-nav-bar', templateUrl: './nav.component.html', styleUrls: ['./nav.component.scss'] }) export class NavComponent { @ViewChild(FilterRefDirective, { static: false }) refDir!: FilterRefDirective; constructor(private resolver: ComponentFactoryResolver) {} openStrokeFilter() { const modalFactory = this.resolver.resolveComponentFactory(FilterTypeComponent); console.log(this.refDir); this.refDir.containerRef.clear(); this.refDir.containerRef.createComponent(modalFactory); } } <button (click)='openStrokeFilter()' class='w-100'>Stroke Type</button>