I have testTry() function in Component1 which accepts one parameter and prints the value.
export class Component1 implements OnInit {
testTry(name:any){
console.log("Name-->",name);}
ngOnInit(){ }
}
I have component2 with a function sampleCall() in which i need to call a function of component1 by sending a parameter
export class Component2 implements OnInit {
sampleCall(){
let a = "Sravya";
testTry(a);
}
ngOnInit(){ }
}
How would I call a function from component1 to component2 without involving HTML?