How do I run a method in component Y from component X in Angular.
method in X component
onClear() {
this.editor.clear();
// environment.templateId=0;
this.openScheduler();
}
like so Y component
X.onclear();
How do I run a method in component Y from component X in Angular.
method in X component
onClear() {
this.editor.clear();
// environment.templateId=0;
this.openScheduler();
}
like so Y component
X.onclear();
If it's parent-child component relation you can do this like this.
@ViewChild('componentName', { static: false })
component: SomeComponent;
And in template:
<component #componentName></component>
Than you can just:
onClear() {
this.editor.clear();
// environment.templateId=0;
this.component.doSomehting();
}