angular - 数据表按钮单击角度 4
问题描述
我在 Angular 4 应用程序中使用数据表。在将数据附加到表时,我使用不同的按钮执行不同的操作
下面是我的代码:
{
data: 'iUserId',
defaultContent: "-",
"mRender": function (data, type, full) {
return '<button class="btn btn-danger btn-xs btn-flat" (click)="deleteUserConfirm('+data+')" title="Delete" data-toggle="tooltip"><i class="fa fa-times"></i></button>'
}
},
我创建了 deleteUserConfirm 方法来对删除按钮单击执行一些操作,但此按钮不调用 angular 方法。如果我不使用数据表,按钮可以正常工作。有没有其他方法可以从数据表中调用 angular 4 方法。
解决方案
将您的 HTML 更改为,
'<button class="btn btn-danger btn-xs btn-flat" (click)="deleteUserConfirm(data)" title="Delete" data-toggle="tooltip"><i class="fa fa-times"></i></button>
推荐阅读
- ios - Vapor / Fluent:过滤嵌套请求
- java - runnable run() 每次我调用它时都会创建一个线程吗?
- javascript - Jest 单元测试 onClick 事件
- reactjs - 如何从 url 获取电子邮件 ID?
- android - 应用 TopAppBar 的插图变为透明?
- javascript - 如何在表单中创建单选按钮组以允许选择餐厅的吸烟/非吸烟部分?
- docker - Caddy作为docker中的反向代理拒绝连接到其他容器
- unicode - 是否有 Unicode 字符来指示字符串中可能的换行符
- android-jetpack-compose - 使用 Jetpack Compose 请求焦点和 setonkeyEvent 后无法从 Activity 返回
- javascript - 解析错误!在函数之外“返回”