在不打开输入的情况下执行功能

时间:2020-01-13 20:52:36

标签: html css angular typescript

我开发了一种输入,可以选择多个文件。在这些选定的文件中,我显示名称和类型。

在单击时的名称和类型类别中,我认为将执行功能,但是,每当单击此处时,输入始终处于打开状态。

当我单击标签以执行function()函数时,如何防止打开输入。

有人可以帮助我吗?

DEMO

HTML

<ngx-dropzone (change)="onSelect($event)">
    <ngx-dropzone-preview *ngFor="let f of files" [removable]="true" (removed)="onRemove(f)">
        <ngx-dropzone-label (click)="function()">({{ f.type }})
      </ngx-dropzone-label>
        <ngx-dropzone-label (click)="function()">{{ f.name }} </ngx-dropzone-label>
    </ngx-dropzone-preview>
</ngx-dropzone>

1 个答案:

答案 0 :(得分:0)

停止事件冒泡应该可以解决问题。

$event.stopPropagation()

请参阅修改后的示例here ->

相关问题