Supposably, I have this class:
Class ExampleClass {
public firstMethod(){
// Do something
}
public secondMethod(){
//Do something with invoke firstMethod
}
}
How can I invoke first method from another correctly? (Simple "firstMethod()" is not working).
Supposably, I have this class:
Class ExampleClass {
public firstMethod(){
// Do something
}
public secondMethod(){
//Do something with invoke firstMethod
}
}
How can I invoke first method from another correctly? (Simple "firstMethod()" is not working).
Share Improve this question edited Nov 17, 2016 at 12:32 Vlad Dekhanov asked Jan 20, 2014 at 17:48 Vlad DekhanovVlad Dekhanov 1,0841 gold badge13 silver badges27 bronze badges1 Answer
Reset to default 26Use this
:
public secondMethod(){
this.firstMethod();
}
If you want to force the binding to the instance, use the => operator :
secondMethod= () => {
this.firstMethod();
}