UNPKG

@progress/kendo-angular-menu

Version:

Kendo UI Angular Menu component

55 lines (54 loc) 2.44 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, TemplateRef, Optional } from '@angular/core'; import * as i0 from "@angular/core"; /** * Represents a template for the Menu items ([see example]({% slug templates_menu %})). To define a template * for an item, nest an `<ng-template>` tag with the `kendoMenuItemTemplate` directive inside a `<kendo-menu-item>` * component. To define a template for all Menu items, nest the template inside the `<kendo-menu>` component. * * The available fields in the template context are: * - `item`&mdash;The item data. * - `index`&mdash;The item index. * * @example * ```ts-preview * * _@Component({ * selector: 'my-app', * template: ` * <kendo-menu> * <kendo-menu-item text="item2"> * <ng-template kendoMenuItemTemplate let-item="item" let-index="index"> * <div style="padding: 10px;"> * My Template for: {{ item.text }} at index: {{ index }} * </div> * </ng-template> * </kendo-menu-item> * </kendo-menu> * ` * }) * * class AppComponent { * } * ``` */ export class ItemTemplateDirective { templateRef; constructor(templateRef) { this.templateRef = templateRef; } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ItemTemplateDirective, deps: [{ token: i0.TemplateRef, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: ItemTemplateDirective, isStandalone: true, selector: "[kendoMenuItemTemplate]", ngImport: i0 }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ItemTemplateDirective, decorators: [{ type: Directive, args: [{ selector: '[kendoMenuItemTemplate]', standalone: true }] }], ctorParameters: () => [{ type: i0.TemplateRef, decorators: [{ type: Optional }] }] });