I need to run 2 methods in the ngOnInit() lifecycle hook, with method2() being executed only after method1() has completed. These methods are not performing HTTP requests and both belong to the same component.
ngOnInit() {
this.method1();
this.method2(); //should only be called once method1() is done
}
method1() {
//do something
}
method2() {
//do something, but should only start after method1 is finished
}
What would be the most effective solution for this issue?