简体   繁体   English

展开 mat-table 行时调用 API

[英]Make API call when mat-table row is expanded

I want to make an API call when the user selects a row to show more details of that particular record in the expansion.当用户选择一行以在扩展中显示该特定记录的更多详细信息时,我想进行 API 调用。 I am referring to https://stackblitz.com/angular/ngrkjbrexbj?file=app%2Ftable-expandable-rows-example.ts .我指的是https://stackblitz.com/angular/ngrkjbrexbj?file=app%2Ftable-expandable-rows-example.ts Is there any way I can achieve this?有什么办法可以做到这一点?

There is a (click) listener that sets expandedElement to current's row element.有一个(click)侦听器将expandedElement设置为当前的行元素。 Hook into this event.勾搭这个事件。

https://stackblitz.com/edit/angular-35wzca https://stackblitz.com/edit/angular-35wzca

you will see console.log message in the console when row is expanding.当行扩展时,您将在控制台中看到console.log消息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM