*hideOnProd directive
import { Directive, ViewContainerRef, OnInit, TemplateRef } from '@angular/core';
import { environment } from 'path/to/environments/environment';
@Directive({
selector: '[hideOnProd]'
})
export class HideOnProdDirective implements OnInit{
constructor(private templateRef: TemplateRef<any>, private viewContainerRef: ViewContainerRef) { }
ngOnInit(): void {
if(environment.production == false){
this.viewContainerRef.createEmbeddedView(this.templateRef);
}
}
}
Top comments (0)