Last active
August 29, 2015 13:56
-
-
Save manviny/9216257 to your computer and use it in GitHub Desktop.
ui-router Resolve
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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