UNPKG

@progress/kendo-angular-common

Version:

Kendo UI for Angular - Utility Package

38 lines (37 loc) 2.03 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { Directive, ViewContainerRef, Input } from '@angular/core'; import * as i0 from "@angular/core"; /** * @hidden */ export class TemplateContextDirective { set templateContext(context) { if (this.insertedViewRef) { this.viewContainerRef.remove(this.viewContainerRef.indexOf(this.insertedViewRef)); this.insertedViewRef = undefined; } if (context.templateRef) { this.insertedViewRef = this.viewContainerRef.createEmbeddedView(context.templateRef, context); } } insertedViewRef; viewContainerRef; constructor(viewContainerRef) { this.viewContainerRef = viewContainerRef; } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TemplateContextDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive }); static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: TemplateContextDirective, isStandalone: true, selector: "[templateContext]", inputs: { templateContext: "templateContext" }, ngImport: i0 }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TemplateContextDirective, decorators: [{ type: Directive, args: [{ // eslint-disable-next-line @angular-eslint/directive-selector selector: '[templateContext]', standalone: true }] }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; }, propDecorators: { templateContext: [{ type: Input }] } });