title: AngularJs: Have method return synchronously when it calls $http or $resource internally
body: <p>Is there a way to wait on a promise so that you can get the actual result from it and return that instead of returning the promise itself?  I'm thinking of something similar to how the C# await keyword works with Tasks.</p>
  
  <p>Here is an example of why I'd like to have a method like canAccess() that returns true or false instead of a promise so that it can be used in an if statement.  The method canAccess() would make an AJAX call using $http or $resource and then somehow wait for the promise to get resolved.</p>
  
  <p>The would look something like this:</p>
  
  <pre><code>$scope.canAccess = function(page) {
      var resource = $resource('/api/access/:page');
      var result = resource.get({page: page});
  
      // how to await this and not return the promise but the real value
      return result.canAccess;
  }
  </code></pre>
  
  <p>Is there anyway to do this?</p>