angular - 如何在按钮单击时添加新功能
问题描述
我在 td 中有一个带有条件的 ngClass,如下所示:
<tr>
<td [ngClass]="{active: !show, inactive: show}"></td>
<td></td>
</tr>
这个 ngClass 在按钮点击功能上被激活,如下所示:
<button type="reset" class="btn btn-primary" (click)="show = !show">Play</button>
现在我必须在此按钮单击上添加功能。怎么能加呢?
解决方案
使用;
向事件添加多个功能。
(click)="show = !show; yourFunction()"
推荐阅读
- python - 将原始二进制转换为频谱图
- reactjs - reactjs如何从属性文件中读取数据
- python - 无限while循环内的Sleep()函数
- nginx - js路由器的Nginx配置
- mysql - 是否可以在 mysql 中插入单词和变量的组合?
- python - 从批处理文件中调用 python 行
- javascript - 我必须在 - npm run build #ReactJs 之后更改静态 /js/css 路径
- java - 是否可以在 Spring/REST 中定义具有相同映射但不同参数的多桩方法?
- javascript - 向下滚动时如何返回false?
- php - Laravel:如何根据每个用户的 id 为每个用户提供不同的登录页面