<div ng-click="method1(); method2()> </div>
Here if the method1() calls the database / external service and gets the data. And method2() is some other behavior execution like UI bindings.
Suppose in case if there is a delay in getting the data from method1(), how to avoid or stop execution of method2() until method1() execution completes.
Note: I can't add method2() call from method1() due to some restrictions. Also I want to execute both these methods from the ng-click only.
ng-click.$q.defer()to assign an asynchronous callback. Perhaps you need to do it inmethod3()where you merge them and resolve your Promises