New to Kendo UI for Angular? Start a free 30-day trial
Edit Breadcrumb Items
Environment
Product | Progress® Kendo UI® for Angular Breadcrumb |
Description
How to edit and update the Breadcrumb items?
Solution
The Breadcrumb can be transformed into a textbox and let the user update its content dynamically.
-
Create a custom edit button and handle its click event. When the button is clicked replace the Breadcrumb with TextBox component:
html<ng-container *ngTemplateOutlet="editing ? editTmpl : breadcrumbTmpl" ></ng-container> <ng-template #breadcrumbTmpl> <kendo-breadcrumb [items]="items"></kendo-breadcrumb> <button kendoButton (click)="startEditing()"...></button> </ng-template> <ng-template #editTmpl> <kendo-textbox ... ><kendo-textbox> </ng-template>
tspublic editing = false; ... public startEditing(): void { this.editing = true; ... }
-
Handle the
valueChange
event of the TextBox component and update theitems
collection of the Breadcrumb component. -
You can further handle the
blur
event of the TextBox, Esc or Enter keydown events to exit the editing mode:html<kendo-textbox (blur)="blur()" (keydown.enter)="confirmEdit($event)" (keydown.esc)="cancelEdit($event)" ...></kendo-textbox>
tspublic confirmEdit(ev: KeyboardEvent): void { this.editing = false; } public cancelEdit(ev: KeyboardEvent): void { this.editing = false; }
The following example demonstrates the implementation of the suggested approach.
Change Theme
Theme
Loading ...