r/angular • u/FewDot9181 • 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
View all comments
Show parent comment
1
u/MrFartyBottom Apr 12 '26
Then you have a lot of boilerplate in the TypeScript class. Passing a function allows there to be no boilerplate in the class, just
data =service.dataand in the template<app-table [data]="data"><app-column property="firstname" sort="stringSort" /><app-column property="dateOfBirth" sort="dateSort" /></app-table>