Call a method of the child component

You can get a reference to an element using

@ViewChild('childComponent') child;

where childComponent is a template variable <some-elem #childComponent>` or

@ViewChild(ComponentType) child;

where ComponentType is the type of a component or directive and then in ngAfterViewInit or an event handlers call child.someFunc().

ngAfterViewInit() {
  console.log(this.child);
}

See also get hold of an element in the template

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)