UNPKG

worker-calendar

Version:

A customizable, responsive Angular calendar component for scheduling worker appointments or shifts

20 lines (18 loc) 559 B
import { Directive, Input, TemplateRef, ViewContainerRef } from '@angular/core'; // This directive allows using of variables in templates @Directive({ selector: '[ngVar]' }) export class NgVarDirective { @Input() set ngVar(context: any) { this.viewContainer.clear(); if (context !== null && context !== undefined) { this.viewContainer.createEmbeddedView(this.templateRef, { $implicit: context }); } } constructor( private templateRef: TemplateRef<any>, private viewContainer: ViewContainerRef ) { } }