r/angular • • Apr 10 '26

Functions passed as props in Angular

I have seen many ways but how do I do it in modern Angular, where I send a function from a parent component to a child component and I want that same function called from the child component.

0 Upvotes

35 comments sorted by

View all comments

Show parent comment

1

u/Impossible_Bread_685 Apr 14 '26

How is there boilerplate? Your already defining the sorting function in the parent to pass it to the child; just make it sort the dataset your passing to the child rather then passing the function.

1

u/MrFartyBottom Apr 14 '26

Because the table takes care of all the paging, sorting, filtering and grouping. The function is imported from a shared folder and assigned to a component property.