如何知道 angular 4 点击事件是否被触发使用 chrome 开发者工具?
How to know if the angular 4 click event is triggered using chrome developer tools?
我的 app.component.html 页面中有以下 html 标签
<a (click)='clicked=0' style='border-style: solid; padding: 5px 50px 5px 50px;' routerLink='/route/show'>Show Details</a>
但是当我在 chrome 中加载此页面并查看 chrome 开发工具中的 html 时,它显示在下面
<a routerlink="/route/show" style="border-style: solid; padding: 5px 50px 5px 50px;" ng-reflect-router-link="/route/show" href="#/route/show">Show Details</a>
为什么它没有在 chrome 开发者工具中显示我的(点击)=='clicked=0'。有什么想看的吗,我用的是angular 4. 谢谢
在编译时,(click)
事件绑定被转换为事件侦听器并且不再作为属性可见,例如:
<a (click)='clicked=0' ...
与您的 routerLink
完全相同被转化为 ng-reflect-router-link
如果您打开开发工具,检查元素,然后打开 事件侦听器 选项卡,您将看到事件已被绑定,您可以将其追踪到(最可能)已生成处理 clicked = 0
.
的匿名函数
我的 app.component.html 页面中有以下 html 标签
<a (click)='clicked=0' style='border-style: solid; padding: 5px 50px 5px 50px;' routerLink='/route/show'>Show Details</a>
但是当我在 chrome 中加载此页面并查看 chrome 开发工具中的 html 时,它显示在下面
<a routerlink="/route/show" style="border-style: solid; padding: 5px 50px 5px 50px;" ng-reflect-router-link="/route/show" href="#/route/show">Show Details</a>
为什么它没有在 chrome 开发者工具中显示我的(点击)=='clicked=0'。有什么想看的吗,我用的是angular 4. 谢谢
在编译时,(click)
事件绑定被转换为事件侦听器并且不再作为属性可见,例如:
<a (click)='clicked=0' ...
与您的 routerLink
完全相同被转化为 ng-reflect-router-link
如果您打开开发工具,检查元素,然后打开 事件侦听器 选项卡,您将看到事件已被绑定,您可以将其追踪到(最可能)已生成处理 clicked = 0
.