Angular ui-router get asynchronous data with resolve
You need to read the docs for resolve. Resolve functions are injectable, and you can use $stateParams to get the correct value from your routes, like so: resolve: { propertyData: function($stateParams, $q) { // The gapi.client.realestate object should really be wrapped in an // injectable service for testability… var deferred = $q.defer(); gapi.client.realestate.get($stateParams.propertyId).execute(function(r) { deferred.resolve(r); … Read more