Skip to content

Instantly share code, notes, and snippets.

@manviny
Last active August 29, 2015 13:56
Show Gist options
  • Save manviny/9216257 to your computer and use it in GitHub Desktop.
Save manviny/9216257 to your computer and use it in GitHub Desktop.
ui-router Resolve
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);
});
return deferred.promise;
}
}
myapp.controller('PropertyController', function($scope, propertyData) {
$scope.property = propertyData;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment