首页 > 解决方案 > Angular - 将点击事件添加到剑道下拉列表项模板

问题描述

<kendo-dropdownlist [formControl]="formGroup?.get('userIdNew')" textField="id" valueField="id"
                [valuePrimitive]="true" id="userName" [data]="users$ | async">
                <ng-template kendoDropDownListValueTemplate let-dataItem>
                    <app-tft-user-name [id]="dataItem?.id" [users]="users$ | async"></app-tft-user-name>
                </ng-template>
                <ng-template kendoDropDownListItemTemplate let-dataItem>
                    <app-tft-user-name [id]="dataItem?.id" [users]="users$ | async"></app-tft-user-name>
                </ng-template>
                <ng-template kendoDropDownListFooterTemplate>
                    <button class="justify-content-center" icon="plus" kendoButton look="clear"
                        (click)="dispatchNewUser()">
                        {{ 'STATUS-TABLE.ADD-USER' | translate }}
                    </button>
                </ng-template>
</kendo-dropdownlist>

当用户从剑道下拉列表中选择一个新值时,我试图触发一个对话框。我尝试在下拉列表中使用 (change)="foo()" ,但我不希望它在用户选择添加新用户时触发,只有当他们从列表中选择现有用户时才会触发。有什么建议么?谢谢!

标签: javascripthtmlangularjskendo-ui

解决方案


推荐阅读