@pepperi/core
Version:
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.0.5.
20 lines (15 loc) • 588 B
text/typescript
import {Directive, OnInit, OnDestroy, Input, TemplateRef} from '@angular/core';
import {PortalService} from './portal.service';
export class AttachDirective implements OnInit, OnDestroy {
targetName: string;
constructor(private portalService: PortalService, private templateRef: TemplateRef<any>) {}
ngOnInit(): void {
this.portalService.attach(this.targetName, this.templateRef);
}
ngOnDestroy(): void {
this.portalService.clear(this.targetName);
}
}