How to add click event on mat-row in angular material table

后端 未结 5 691
时光说笑
时光说笑 2020-12-28 14:23

I added this but when inspecting element using Chrome DevTools, the click function doesn\'t show!

Here\'s my code:



        
5条回答
  •  無奈伤痛
    2020-12-28 14:40

    Watch your *matRowDef, you created a row variable, yet in your click event, you're giving an element one.

    
    

    Otherwise, you won't see it be inspecting it : Angular creates event listeners in JS to handle events. You can either create it in HTML or in Javascript, they choose to do it in Javascript. Just test your function with a console log, it should work.

提交回复
热议问题