Angular validation logic with async calls
<p>I'm using Angular 1 and having to implement some validation logic in a controller as follow:</p>

<pre><code>$scope.onValidate = function(){
    var orderId = $resource("/getorderId");
    if (!orderId){
        return false;
    }

    var isValidAddress = $resource("/checkAddress")
    if (!isValidAddress){
        return false;
    }

    // some other checking 

    return true;
}
</code></pre>

<p>But as we know $resource is async and will return immediately. My question is what should be the right approach in Angular 1 to perform such sequential checking which needs to get result from server side and should wait until all conditions are checked before return.</p>