Run method of the child component


#1

Hello,

I’ve 2 components. I’ve the written hours comp with a in it from the flex-calendar comp.

I want to have a button in the written-hours page that triggers the renderCalendar method in the flexCalendar.

I use EventMiter to communicate with the written-hours page FlexCalendar -> writtenHours.DateChange() but now i want:

buttonClick (written-h.) -> written-hours.gotoToday() -> flex-Calendar.goToDate(date)

Does someone know how to do this?


#2

In angular 2 there is such things as ViewChild and ViewChildren:
https://angular.io/docs/ts/latest/api/core/ViewChild-var.html
https://angular.io/docs/ts/latest/api/core/ViewChildren-var.html

Maybe this will help you.
Simply by using this you can access underlying components and their’s methods and properties


#3

You could use @Output/@Input


#4

Thank you this fixed my problem!